type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
() => {
app.disableDomainBlockingFor3DAPIs();
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
after(async () => {
await app.dock.show();
});
describe('dock.setMenu', () => {
it('can be retrieved via dock.getMenu', () => {
expect(app.dock.getMenu()).to.equal(null);
const menu = new Menu();
app.dock.setMenu(menu);
expect(app.dock.getMenu()).to.equal(menu);
});
it('keeps references to the menu', () => {
app.dock.setMenu(new Menu());
const v8Util = process._linkedBinding('electron_common_v8_util');
v8Util.requestGarbageCollectionForTesting();
});
});
describe('dock.setIcon', () => {
it('throws a descriptive error for a bad icon path', () => {
const badPath = path.resolve('I', 'Do', 'Not', 'Exist');
expect(() => {
app.dock.setIcon(badPath);
}).to.throw(/Failed to load image from path (.+)/);
});
});
describe('dock.bounce', () => {
it('should return -1 for unknown bounce type', () => {
expect(app.dock.bounce('bad type' as any)).to.equal(-1);
});
it('should return a positive number for informational type', () => {
const appHasFocus = !!BrowserWindow.getFocusedWindow();
if (!appHasFocus) {
expect(app.dock.bounce('informational')).to.be.at.least(0);
}
});
it('should return a positive number for critical type', () => {
const appHasFocus = !!BrowserWindow.getFocusedWindow();
if (!appHasFocus) {
expect(app.dock.bounce('critical')).to.be.at.least(0);
}
});
});
describe('dock.cancelBounce', () => {
it('should not throw', () => {
app.dock.cancelBounce(app.dock.bounce('critical'));
});
});
describe('dock.setBadge', () => {
after(() => {
app.dock.setBadge('');
});
it('should not throw', () => {
app.dock.setBadge('1');
});
it('should be retrievable via getBadge', () => {
app.dock.setBadge('test');
expect(app.dock.getBadge()).to.equal('test');
});
});
describe('dock.hide', () => {
it('should not throw', () => {
app.dock.hide();
expect(app.dock.isVisible()).to.equal(false);
});
});
// Note that dock.show tests should run after dock.hide tests, to work
// around a bug of macOS.
// See https://github.com/electron/electron/pull/25269 for more.
describe('dock.show', () => {
it('should not throw', () => {
return app.dock.show().then(() => {
expect(app.dock.isVisible()).to.equal(true);
});
});
it('returns a Promise', () => {
expect(app.dock.show()).to.be.a('promise');
});
it('eventually fulfills', async () => {
await expect(app.dock.show()).to.eventually.be.fulfilled.equal(undefined);
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
await app.dock.show();
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('can be retrieved via dock.getMenu', () => {
expect(app.dock.getMenu()).to.equal(null);
const menu = new Menu();
app.dock.setMenu(menu);
expect(app.dock.getMenu()).to.equal(menu);
});
it('keeps references to the menu', () => {
app.dock.setMenu(new Menu());
const v8Util = process._linkedBinding('electron_common_v8_util');
v8Util.requestGarbageCollectionForTesting();
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.dock.getMenu()).to.equal(null);
const menu = new Menu();
app.dock.setMenu(menu);
expect(app.dock.getMenu()).to.equal(menu);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.dock.setMenu(new Menu());
const v8Util = process._linkedBinding('electron_common_v8_util');
v8Util.requestGarbageCollectionForTesting();
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('throws a descriptive error for a bad icon path', () => {
const badPath = path.resolve('I', 'Do', 'Not', 'Exist');
expect(() => {
app.dock.setIcon(badPath);
}).to.throw(/Failed to load image from path (.+)/);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const badPath = path.resolve('I', 'Do', 'Not', 'Exist');
expect(() => {
app.dock.setIcon(badPath);
}).to.throw(/Failed to load image from path (.+)/);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.dock.setIcon(badPath);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('should return -1 for unknown bounce type', () => {
expect(app.dock.bounce('bad type' as any)).to.equal(-1);
});
it('should return a positive number for informational type', () => {
const appHasFocus = !!BrowserWindow.getFocusedWindow();
if (!appHasFocus) {
expect(app.dock.bounce('informational')).to.be.at.least(0);
}
});
it('should return a positive number for critical type', () => {
const appHasFocus = !!BrowserWindow.getFocusedWindow();
if (!appHasFocus) {
expect(app.dock.bounce('critical')).to.be.at.least(0);
}
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.dock.bounce('bad type' as any)).to.equal(-1);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const appHasFocus = !!BrowserWindow.getFocusedWindow();
if (!appHasFocus) {
expect(app.dock.bounce('informational')).to.be.at.least(0);
}
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
const appHasFocus = !!BrowserWindow.getFocusedWindow();
if (!appHasFocus) {
expect(app.dock.bounce('critical')).to.be.at.least(0);
}
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('should not throw', () => {
app.dock.cancelBounce(app.dock.bounce('critical'));
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.dock.cancelBounce(app.dock.bounce('critical'));
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
after(() => {
app.dock.setBadge('');
});
it('should not throw', () => {
app.dock.setBadge('1');
});
it('should be retrievable via getBadge', () => {
app.dock.setBadge('test');
expect(app.dock.getBadge()).to.equal('test');
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.dock.setBadge('');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.dock.setBadge('1');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.dock.setBadge('test');
expect(app.dock.getBadge()).to.equal('test');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('should not throw', () => {
app.dock.hide();
expect(app.dock.isVisible()).to.equal(false);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.dock.hide();
expect(app.dock.isVisible()).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('should not throw', () => {
return app.dock.show().then(() => {
expect(app.dock.isVisible()).to.equal(true);
});
});
it('returns a Promise', () => {
expect(app.dock.show()).to.be.a('promise');
});
it('eventually fulfills', async () => {
await expect(app.dock.show()).to.eventually.be.fulfilled.equal(undefined);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
return app.dock.show().then(() => {
expect(app.dock.isVisible()).to.equal(true);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.dock.isVisible()).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.dock.show()).to.be.a('promise');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
await expect(app.dock.show()).to.eventually.be.fulfilled.equal(undefined);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns a Promise', () => {
expect(app.whenReady()).to.be.a('promise');
});
it('becomes fulfilled if the app is already ready', async () => {
expect(app.isReady()).to.equal(true);
await expect(app.whenReady()).to.be.eventually.fulfilled.equal(undefined);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.whenReady()).to.be.a('promise');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
expect(app.isReady()).to.equal(true);
await expect(app.whenReady()).to.be.eventually.fulfilled.equal(undefined);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('has the applicationMenu property', () => {
expect(app).to.have.property('applicationMenu');
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app).to.have.property('applicationMenu');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns true when present', () => {
app.commandLine.appendSwitch('foobar1');
expect(app.commandLine.hasSwitch('foobar1')).to.equal(true);
});
it('returns false when not present', () => {
expect(app.commandLine.hasSwitch('foobar2')).to.equal(false);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.commandLine.appendSwitch('foobar1');
expect(app.commandLine.hasSwitch('foobar1')).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.commandLine.hasSwitch('foobar2')).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns true when present', async () => {
const { hasSwitch } = await runTestApp('command-line', '--foobar');
expect(hasSwitch).to.equal(true);
});
it('returns false when not present', async () => {
const { hasSwitch } = await runTestApp('command-line');
expect(hasSwitch).to.equal(false);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const { hasSwitch } = await runTestApp('command-line', '--foobar');
expect(hasSwitch).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const { hasSwitch } = await runTestApp('command-line');
expect(hasSwitch).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns the value when present', () => {
app.commandLine.appendSwitch('foobar', 'æøåü');
expect(app.commandLine.getSwitchValue('foobar')).to.equal('æøåü');
});
it('returns an empty string when present without value', () => {
app.commandLine.appendSwitch('foobar1');
expect(app.commandLine.getSwitchValue('foobar1')).to.equal('');
});
it('returns an empty string when not present', () => {
expect(app.commandLine.getSwitchValue('foobar2')).to.equal('');
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.commandLine.appendSwitch('foobar', 'æøåü');
expect(app.commandLine.getSwitchValue('foobar')).to.equal('æøåü');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.commandLine.appendSwitch('foobar1');
expect(app.commandLine.getSwitchValue('foobar1')).to.equal('');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.commandLine.getSwitchValue('foobar2')).to.equal('');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('returns the value when present', async () => {
const { getSwitchValue } = await runTestApp('command-line', '--foobar=test');
expect(getSwitchValue).to.equal('test');
});
it('returns an empty string when present without value', async () => {
const { getSwitchValue } = await runTestApp('command-line', '--foobar');
expect(getSwitchValue).to.equal('');
});
it('returns an empty string when not present', async () => {
const { getSwitchValue } = await runTestApp('command-line');
expect(getSwitchValue).to.equal('');
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const { getSwitchValue } = await runTestApp('command-line', '--foobar=test');
expect(getSwitchValue).to.equal('test');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const { getSwitchValue } = await runTestApp('command-line', '--foobar');
expect(getSwitchValue).to.equal('');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const { getSwitchValue } = await runTestApp('command-line');
expect(getSwitchValue).to.equal('');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('changes Secure Keyboard Entry is enabled', () => {
app.setSecureKeyboardEntryEnabled(true);
expect(app.isSecureKeyboardEntryEnabled()).to.equal(true);
app.setSecureKeyboardEntryEnabled(false);
expect(app.isSecureKeyboardEntryEnabled()).to.equal(false);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.setSecureKeyboardEntryEnabled(true);
expect(app.isSecureKeyboardEntryEnabled()).to.equal(true);
app.setSecureKeyboardEntryEnabled(false);
expect(app.isSecureKeyboardEntryEnabled()).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
describe('application menu', () => {
it('creates the default menu if the app does not set it', async () => {
const result = await runTestApp('default-menu');
expect(result).to.equal(false);
});
it('does not create the default menu if the app sets a custom menu', async () => {
const result = await runTestApp('default-menu', '--custom-menu');
expect(result).to.equal(true);
});
it('does not create the default menu if the app sets a null menu', async () => {
const result = await runTestApp('default-menu', '--null-menu');
expect(result).to.equal(true);
});
});
describe('window-all-closed', () => {
it('quits when the app does not handle the event', async () => {
const result = await runTestApp('window-all-closed');
expect(result).to.equal(false);
});
it('does not quit when the app handles the event', async () => {
const result = await runTestApp('window-all-closed', '--handle-event');
expect(result).to.equal(true);
});
});
describe('user agent fallback', () => {
let initialValue: string;
before(() => {
initialValue = app.userAgentFallback!;
});
it('should have a reasonable default', () => {
expect(initialValue).to.include(`Electron/${process.versions.electron}`);
expect(initialValue).to.include(`Chrome/${process.versions.chrome}`);
});
it('should be overridable', () => {
app.userAgentFallback = 'test-agent/123';
expect(app.userAgentFallback).to.equal('test-agent/123');
});
it('should be restorable', () => {
app.userAgentFallback = 'test-agent/123';
app.userAgentFallback = '';
expect(app.userAgentFallback).to.equal(initialValue);
});
});
describe('app.allowRendererProcessReuse', () => {
it('should default to true', () => {
expect(app.allowRendererProcessReuse).to.equal(true);
});
it('should cause renderer processes to get new PIDs when false', async () => {
const output = await runTestApp('site-instance-overrides', 'false');
expect(output[0]).to.be.a('number').that.is.greaterThan(0);
expect(output[1]).to.be.a('number').that.is.greaterThan(0);
expect(output[0]).to.not.equal(output[1]);
});
it('should cause renderer processes to keep the same PID when true', async () => {
const output = await runTestApp('site-instance-overrides', 'true');
expect(output[0]).to.be.a('number').that.is.greaterThan(0);
expect(output[1]).to.be.a('number').that.is.greaterThan(0);
expect(output[0]).to.equal(output[1]);
});
});
describe('login event', () => {
afterEach(closeAllWindows);
let server: http.Server;
let serverUrl: string;
before((done) => {
server = http.createServer((request, response) => {
if (request.headers.authorization) {
return response.end('ok');
}
response
.writeHead(401, { 'WWW-Authenticate': 'Basic realm="Foo"' })
.end();
}).listen(0, '127.0.0.1', () => {
serverUrl = 'http://127.0.0.1:' + (server.address() as net.AddressInfo).port;
done();
});
});
it('should emit a login event on app when a WebContents hits a 401', async () => {
const w = new BrowserWindow({ show: false });
w.loadURL(serverUrl);
const [, webContents] = await emittedOnce(app, 'login');
expect(webContents).to.equal(w.webContents);
});
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('creates the default menu if the app does not set it', async () => {
const result = await runTestApp('default-menu');
expect(result).to.equal(false);
});
it('does not create the default menu if the app sets a custom menu', async () => {
const result = await runTestApp('default-menu', '--custom-menu');
expect(result).to.equal(true);
});
it('does not create the default menu if the app sets a null menu', async () => {
const result = await runTestApp('default-menu', '--null-menu');
expect(result).to.equal(true);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const result = await runTestApp('default-menu');
expect(result).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const result = await runTestApp('default-menu', '--custom-menu');
expect(result).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const result = await runTestApp('default-menu', '--null-menu');
expect(result).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('quits when the app does not handle the event', async () => {
const result = await runTestApp('window-all-closed');
expect(result).to.equal(false);
});
it('does not quit when the app handles the event', async () => {
const result = await runTestApp('window-all-closed', '--handle-event');
expect(result).to.equal(true);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const result = await runTestApp('window-all-closed');
expect(result).to.equal(false);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const result = await runTestApp('window-all-closed', '--handle-event');
expect(result).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
let initialValue: string;
before(() => {
initialValue = app.userAgentFallback!;
});
it('should have a reasonable default', () => {
expect(initialValue).to.include(`Electron/${process.versions.electron}`);
expect(initialValue).to.include(`Chrome/${process.versions.chrome}`);
});
it('should be overridable', () => {
app.userAgentFallback = 'test-agent/123';
expect(app.userAgentFallback).to.equal('test-agent/123');
});
it('should be restorable', () => {
app.userAgentFallback = 'test-agent/123';
app.userAgentFallback = '';
expect(app.userAgentFallback).to.equal(initialValue);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
initialValue = app.userAgentFallback!;
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(initialValue).to.include(`Electron/${process.versions.electron}`);
expect(initialValue).to.include(`Chrome/${process.versions.chrome}`);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.userAgentFallback = 'test-agent/123';
expect(app.userAgentFallback).to.equal('test-agent/123');
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
app.userAgentFallback = 'test-agent/123';
app.userAgentFallback = '';
expect(app.userAgentFallback).to.equal(initialValue);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
it('should default to true', () => {
expect(app.allowRendererProcessReuse).to.equal(true);
});
it('should cause renderer processes to get new PIDs when false', async () => {
const output = await runTestApp('site-instance-overrides', 'false');
expect(output[0]).to.be.a('number').that.is.greaterThan(0);
expect(output[1]).to.be.a('number').that.is.greaterThan(0);
expect(output[0]).to.not.equal(output[1]);
});
it('should cause renderer processes to keep the same PID when true', async () => {
const output = await runTestApp('site-instance-overrides', 'true');
expect(output[0]).to.be.a('number').that.is.greaterThan(0);
expect(output[1]).to.be.a('number').that.is.greaterThan(0);
expect(output[0]).to.equal(output[1]);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
expect(app.allowRendererProcessReuse).to.equal(true);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const output = await runTestApp('site-instance-overrides', 'false');
expect(output[0]).to.be.a('number').that.is.greaterThan(0);
expect(output[1]).to.be.a('number').that.is.greaterThan(0);
expect(output[0]).to.not.equal(output[1]);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const output = await runTestApp('site-instance-overrides', 'true');
expect(output[0]).to.be.a('number').that.is.greaterThan(0);
expect(output[1]).to.be.a('number').that.is.greaterThan(0);
expect(output[0]).to.equal(output[1]);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
afterEach(closeAllWindows);
let server: http.Server;
let serverUrl: string;
before((done) => {
server = http.createServer((request, response) => {
if (request.headers.authorization) {
return response.end('ok');
}
response
.writeHead(401, { 'WWW-Authenticate': 'Basic realm="Foo"' })
.end();
}).listen(0, '127.0.0.1', () => {
serverUrl = 'http://127.0.0.1:' + (server.address() as net.AddressInfo).port;
done();
});
});
it('should emit a login event on app when a WebContents hits a 401', async () => {
const w = new BrowserWindow({ show: false });
w.loadURL(serverUrl);
const [, webContents] = await emittedOnce(app, 'login');
expect(webContents).to.equal(w.webContents);
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
(done) => {
server = http.createServer((request, response) => {
if (request.headers.authorization) {
return response.end('ok');
}
response
.writeHead(401, { 'WWW-Authenticate': 'Basic realm="Foo"' })
.end();
}).listen(0, '127.0.0.1', () => {
serverUrl = 'http://127.0.0.1:' + (server.address() as net.AddressInfo).port;
done();
});
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
(request, response) => {
if (request.headers.authorization) {
return response.end('ok');
}
response
.writeHead(401, { 'WWW-Authenticate': 'Basic realm="Foo"' })
.end();
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
() => {
serverUrl = 'http://127.0.0.1:' + (server.address() as net.AddressInfo).port;
done();
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
async () => {
const w = new BrowserWindow({ show: false });
w.loadURL(serverUrl);
const [, webContents] = await emittedOnce(app, 'login');
expect(webContents).to.equal(w.webContents);
} | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
(data) => { output += data; } | fisabelle-lmi/electron | spec-main/api-app-spec.ts | TypeScript |
ArrowFunction |
(props) => {
const { hidden, handleChange, handleBlur, values } = props;
const handleLabel = (label: LabelDefinition) => {
handleChange(createFakeEvent("labels", [...values.labels, label]) as any);
handleBlur(createFakeEvent("labels") as any);
};
const removeLabel = (idx: number) => {
const labels = values.labels.filter((label, i) => i !== idx);
handleChange(createFakeEvent("labels", labels) as any);
};
return (
<React.Fragment>
<EuiFlexGroup
style={hidden ? HIDDEN_STYLE : {}}
gutterSize="s"
responsive={false}
>
<EuiFlexItem>
<BooleanLabelForm labels={values.labels} handleLabel={handleLabel} />
</EuiFlexItem>
<EuiFlexItem>
<NumericalLabelForm
labels={values.labels}
handleLabel={handleLabel}
/>
</EuiFlexItem>
</EuiFlexGroup>
<EuiListGroup style={hidden ? HIDDEN_STYLE : {}}>
<EuiSpacer size="m" />
{values.labels.map((label, i) => {
const color = label.variant === "numerical" ? "secondary" : "primary";
const append = `(${label.minimum}, ${label.maximum}, ${label.interval})`;
const badgeContent = `${label.variant} ${
label.variant === "numerical" ? append : ""
}`;
return (
<EuiListGroupItem
key={label.name}
icon={<EuiAvatar size="s" type="space" name={label.name} />}
label={
<span>
{label.name + " "}
<EuiBadge color={color}>{badgeContent}</EuiBadge>
</span>
}
extraAction={{
iconType: "trash",
alwaysShow: true,
"aria-label": "Delete label",
onClick: () => removeLabel(i),
}} | VarityPlatform/lablr | frontend/src/views/create-dataset-page/LabelsTab.tsx | TypeScript |
ArrowFunction |
(label: LabelDefinition) => {
handleChange(createFakeEvent("labels", [...values.labels, label]) as any);
handleBlur(createFakeEvent("labels") as any);
} | VarityPlatform/lablr | frontend/src/views/create-dataset-page/LabelsTab.tsx | TypeScript |
ArrowFunction |
(idx: number) => {
const labels = values.labels.filter((label, i) => i !== idx);
handleChange(createFakeEvent("labels", labels) as any);
} | VarityPlatform/lablr | frontend/src/views/create-dataset-page/LabelsTab.tsx | TypeScript |
ArrowFunction |
(label, i) => i !== idx | VarityPlatform/lablr | frontend/src/views/create-dataset-page/LabelsTab.tsx | TypeScript |
ArrowFunction |
(label, i) => {
const color = label.variant === "numerical" ? "secondary" : "primary";
const append = `(${label.minimum}, ${label.maximum}, ${label.interval})`;
const badgeContent = `${label.variant} ${
label.variant === "numerical" ? append : ""
}`;
return (
<EuiListGroupItem
key={label.name}
icon={<EuiAvatar size="s" type="space" name={label.name} />} | VarityPlatform/lablr | frontend/src/views/create-dataset-page/LabelsTab.tsx | TypeScript |
ArrowFunction |
() => removeLabel(i) | VarityPlatform/lablr | frontend/src/views/create-dataset-page/LabelsTab.tsx | TypeScript |
InterfaceDeclaration |
interface IProps {
hidden: boolean;
handleChange: (event: React.SyntheticEvent) => void;
handleBlur: (event: React.SyntheticEvent) => void;
values: FormValues;
} | VarityPlatform/lablr | frontend/src/views/create-dataset-page/LabelsTab.tsx | TypeScript |
FunctionDeclaration |
export declare function getEmitFlags(node: ts.Node): ts.EmitFlags | undefined; | 5g-media/5G-MEDIA_AAA | node_modules/tsickle/src/typescript.d.ts | TypeScript |
ArrowFunction |
props => {
const internal = /^\/(?!\/)/.test(props.to);
if (internal) {
return <GatsbyLink to={props.to}>{props.children}</GatsbyLink>;
}
return <a href={props.to}>{props.children}</a>;
} | dvonlehman/gatsby-mdx-blog-starter-project | src/components/Link.tsx | TypeScript |
InterfaceDeclaration |
interface LinkProps {
to: string;
} | dvonlehman/gatsby-mdx-blog-starter-project | src/components/Link.tsx | TypeScript |
FunctionDeclaration |
export function getJsonObj(
obj: EnableExternalPluggableDatabaseOperationsInsightsDetails
): object {
const jsonObj = { ...obj, ...{} };
return jsonObj;
} | ramjiiyengar/oci-typescript-sdk | lib/database/lib/model/enable-external-pluggable-database-operations-insights-details.ts | TypeScript |
FunctionDeclaration |
export function getDeserializedJsonObj(
obj: EnableExternalPluggableDatabaseOperationsInsightsDetails
): object {
const jsonObj = { ...obj, ...{} };
return jsonObj;
} | ramjiiyengar/oci-typescript-sdk | lib/database/lib/model/enable-external-pluggable-database-operations-insights-details.ts | TypeScript |
InterfaceDeclaration | /**
* Details to enable Operations Insights on the external pluggable database
*/
export interface EnableExternalPluggableDatabaseOperationsInsightsDetails {
/**
* The [OCID](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the
* {@link #createExternalDatabaseConnectorDetails(CreateExternalDatabaseConnectorDetailsRequest) createExternalDatabaseConnectorDetails}.
*
*/
"externalDatabaseConnectorId": string;
} | ramjiiyengar/oci-typescript-sdk | lib/database/lib/model/enable-external-pluggable-database-operations-insights-details.ts | TypeScript |
ArrowFunction |
props => {
const action = getActionById(
getConnectorActions(getConnectionConnector(props.connection)),
props.actionId
);
return (
<WithActionDescriptor
connectionId={props.connection.id!}
actionId={action.id!}
configuredProperties={props.initialValue || {}}
>
{({ data, hasData, error, errorMessage }) | PiBeach/syndesis | app/ui-react/syndesis/src/modules/integrations/components/editor/endpoint/WithConfigurationForm.tsx | TypeScript |
InterfaceDeclaration |
export interface IOnUpdatedIntegrationProps {
/**
* the action object that has been configured.
*/
action: Action;
/**
* true if the configuration is not complete because there are other steps,
* false otherwise.
* If true the form should be re-rendered with an incremented
* [configurationPage]{@link IWithConfigurationFormProps#configurationPage}.
*/
moreConfigurationSteps: boolean;
/**
* the configured values.
*/
values: { [key: string]: string } | null;
} | PiBeach/syndesis | app/ui-react/syndesis/src/modules/integrations/components/editor/endpoint/WithConfigurationForm.tsx | TypeScript |
InterfaceDeclaration |
export interface IWithConfigurationFormProps {
/**
* the connection object that contains the action with the provided
* [actionId]{@link IWithConfigurationFormProps#actionId}. Used to retrieve
* the form definition.
*/
connection: IConnectionOverview;
/**
* the ID of the action that needs to be configured.
*/
actionId: string;
oldAction?: Action;
/**
* for actions whose configuration must be performed in multiple steps,
* indicates the current step.
*/
configurationPage: number;
/**
* the values to assign to the form once rendered. These can come either from
* an existing integration or from the [onUpdatedIntegration]{@link IWithConfigurationFormProps#onUpdatedIntegration}
* callback.
*/
initialValue?: { [key: string]: string };
chooseActionHref: H.LocationDescriptor;
/**
* the callback that is fired after the form submit with valid values.
*
* @see [action]{@link IOnUpdatedIntegrationProps#action}
* @see [moreConfigurationSteps]{@link IOnUpdatedIntegrationProps#moreConfigurationSteps}
* @see [values]{@link IOnUpdatedIntegrationProps#values}
*/
onUpdatedIntegration(props: IOnUpdatedIntegrationProps): Promise<void>;
} | PiBeach/syndesis | app/ui-react/syndesis/src/modules/integrations/components/editor/endpoint/WithConfigurationForm.tsx | TypeScript |
FunctionDeclaration |
export function Delay(time?: number): ClassDecorator {
return target => {
Reflect.defineMetadata(NAMESPACE.DELAY, time || -1, target);
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function Description(str: string): ClassDecorator {
return target => {
Reflect.defineMetadata(NAMESPACE.DESCRIPTION, str, target);
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function Group(group: string): ClassDecorator {
return target => {
Reflect.defineMetadata(NAMESPACE.GROUP, group, target);
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function Interface(name: string): ClassDecorator {
return target => {
Reflect.defineMetadata(NAMESPACE.INTERFACE, name, target);
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function Method(target: Object, property: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => any>) {
Reflect.defineMetadata(NAMESPACE.METHOD, true, descriptor.value);
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function Retries(count?: number): ClassDecorator {
return target => {
Reflect.defineMetadata(NAMESPACE.RETRIES, count || 2, target);
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function Timeout(time?: number): ClassDecorator {
return target => {
Reflect.defineMetadata(NAMESPACE.TIMEOUT, time || 3000, target);
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function Version(version?: string): ClassDecorator {
return target => {
Reflect.defineMetadata(NAMESPACE.VERSION, version || '0.0.0', target);
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function setParameterMetaData<T = any>(callback: (ctx: Context) => T): ParameterDecorator {
return (target, property, index) => {
const clazz = target.constructor.prototype[property];
const meta = ParameterMetadata.bind(clazz);
meta.set(index, callback);
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function setFunctionalParameterMetaData<T = any>(callback: (ctx: Context, ...args: any[]) => T) {
return (...args: any[]): ParameterDecorator => {
return (target, property, index) => {
const clazz = target.constructor.prototype[property];
const meta = ParameterMetadata.bind(clazz);
meta.set(index, (ctx) => callback(ctx, ...args));
}
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
FunctionDeclaration |
export function Middleware<T extends Context = Context>(...args: ComposeMiddleware<T>[]): MethodDecorator {
return (target, property, descriptor) => {
const clazz = descriptor.value;
if (!Reflect.hasMetadata(NAMESPACE.MIDDLEWARE, clazz)) Reflect.defineMetadata(NAMESPACE.MIDDLEWARE, new MiddlewareMetadata<T>(), clazz);
const metadata = Reflect.getMetadata(NAMESPACE.MIDDLEWARE, clazz) as MiddlewareMetadata<T>;
metadata.use(...args);
}
} | typeservice/dubbo | src/decorates.ts | TypeScript |
ArrowFunction |
target => {
Reflect.defineMetadata(NAMESPACE.DELAY, time || -1, target);
} | typeservice/dubbo | src/decorates.ts | TypeScript |
ArrowFunction |
target => {
Reflect.defineMetadata(NAMESPACE.DESCRIPTION, str, target);
} | typeservice/dubbo | src/decorates.ts | TypeScript |
ArrowFunction |
target => {
Reflect.defineMetadata(NAMESPACE.GROUP, group, target);
} | typeservice/dubbo | src/decorates.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.