type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
MethodDeclaration
update(params: Params$Resource$Sinks$Update, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
update(params: Params$Resource$Sinks$Update, options: MethodOptions | BodyResponseCallback<Schema$LogSink>, callback: BodyResponseCallback<Schema$LogSink>): void;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
update(params: Params$Resource$Sinks$Update, callback: BodyResponseCallback<Schema$LogSink>): void;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
/** * logging.getCmekSettings * @desc Gets the Logs Router CMEK settings for the given resource.Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.See Enabling CMEK for Logs Router (https://cloud.google.com/logging/docs/routing/managed-encryption) for more information. * @example * // Before running the sample: * // - Enable the API at: * // https://console.developers.google.com/apis/api/logging.googleapis.com * // - Login into gcloud by running: * // `$ gcloud auth application-default login` * // - Install the npm module by running: * // `$ npm install googleapis` * * const {google} = require('googleapis'); * const logging = google.logging('v2'); * * async function main() { * const auth = new google.auth.GoogleAuth({ * // Scopes can be specified either as an array or as a single, space-delimited string. * scopes: [ * 'https://www.googleapis.com/auth/cloud-platform', * 'https://www.googleapis.com/auth/cloud-platform.read-only', * 'https://www.googleapis.com/auth/logging.admin', * 'https://www.googleapis.com/auth/logging.read', * ], * }); * * // Acquire an auth client, and bind it to all future calls * const authClient = await auth.getClient(); * google.options('auth', authClient); * * // Do the magic * const res = await logging.getCmekSettings({ * // Required. The resource for which to retrieve CMEK settings. * // "projects/[PROJECT_ID]/cmekSettings" * // "organizations/[ORGANIZATION_ID]/cmekSettings" * // "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" * // "folders/[FOLDER_ID]/cmekSettings" * // Example: "organizations/12345/cmekSettings".Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization. * name: '[^/]+/[^/]+', * }); * console.log(res.data); * * // Example response * // { * // "kmsKeyName": "my_kmsKeyName", * // "name": "my_name", * // "serviceAccountId": "my_serviceAccountId" * // } * } * * main().catch(e => { * console.error(e); * throw e; * }); * * @alias logging.getCmekSettings * @memberOf! () * * @param {object} params Parameters for request * @param {string} params.name Required. The resource for which to retrieve CMEK settings. "projects/[PROJECT_ID]/cmekSettings" "organizations/[ORGANIZATION_ID]/cmekSettings" "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" "folders/[FOLDER_ID]/cmekSettings" Example: "organizations/12345/cmekSettings".Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization. * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ getCmekSettings(params: Params$Resource$V2$Getcmeksettings, options: StreamMethodOptions): GaxiosPromise<Readable>;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
getCmekSettings(params?: Params$Resource$V2$Getcmeksettings, options?: MethodOptions): GaxiosPromise<Schema$CmekSettings>;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
getCmekSettings(params: Params$Resource$V2$Getcmeksettings, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
getCmekSettings(params: Params$Resource$V2$Getcmeksettings, options: MethodOptions | BodyResponseCallback<Schema$CmekSettings>, callback: BodyResponseCallback<Schema$CmekSettings>): void;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
getCmekSettings(params: Params$Resource$V2$Getcmeksettings, callback: BodyResponseCallback<Schema$CmekSettings>): void;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
/** * logging.updateCmekSettings * @desc Updates the Logs Router CMEK settings for the given resource.Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.UpdateCmekSettings will fail if 1) kms_key_name is invalid, or 2) the associated service account does not have the required roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or 3) access to the key is disabled.See Enabling CMEK for Logs Router (https://cloud.google.com/logging/docs/routing/managed-encryption) for more information. * @example * // Before running the sample: * // - Enable the API at: * // https://console.developers.google.com/apis/api/logging.googleapis.com * // - Login into gcloud by running: * // `$ gcloud auth application-default login` * // - Install the npm module by running: * // `$ npm install googleapis` * * const {google} = require('googleapis'); * const logging = google.logging('v2'); * * async function main() { * const auth = new google.auth.GoogleAuth({ * // Scopes can be specified either as an array or as a single, space-delimited string. * scopes: [ * 'https://www.googleapis.com/auth/cloud-platform', * 'https://www.googleapis.com/auth/logging.admin', * ], * }); * * // Acquire an auth client, and bind it to all future calls * const authClient = await auth.getClient(); * google.options('auth', authClient); * * // Do the magic * const res = await logging.updateCmekSettings({ * // Required. The resource name for the CMEK settings to update. * // "projects/[PROJECT_ID]/cmekSettings" * // "organizations/[ORGANIZATION_ID]/cmekSettings" * // "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" * // "folders/[FOLDER_ID]/cmekSettings" * // Example: "organizations/12345/cmekSettings".Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization. * name: '[^/]+/[^/]+', * // Optional. Field mask identifying which fields from cmek_settings should be updated. A field will be overwritten if and only if it is in the update mask. Output only fields cannot be updated.See FieldMask for more information.Example: "updateMask=kmsKeyName" * updateMask: 'placeholder-value', * * // Request body metadata * requestBody: { * // request body parameters * // { * // "kmsKeyName": "my_kmsKeyName", * // "name": "my_name", * // "serviceAccountId": "my_serviceAccountId" * // } * }, * }); * console.log(res.data); * * // Example response * // { * // "kmsKeyName": "my_kmsKeyName", * // "name": "my_name", * // "serviceAccountId": "my_serviceAccountId" * // } * } * * main().catch(e => { * console.error(e); * throw e; * }); * * @alias logging.updateCmekSettings * @memberOf! () * * @param {object} params Parameters for request * @param {string} params.name Required. The resource name for the CMEK settings to update. "projects/[PROJECT_ID]/cmekSettings" "organizations/[ORGANIZATION_ID]/cmekSettings" "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" "folders/[FOLDER_ID]/cmekSettings" Example: "organizations/12345/cmekSettings".Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization. * @param {string=} params.updateMask Optional. Field mask identifying which fields from cmek_settings should be updated. A field will be overwritten if and only if it is in the update mask. Output only fields cannot be updated.See FieldMask for more information.Example: "updateMask=kmsKeyName" * @param {().CmekSettings} params.requestBody Request body data * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ updateCmekSettings(params: Params$Resource$V2$Updatecmeksettings, options: StreamMethodOptions): GaxiosPromise<Readable>;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
updateCmekSettings(params?: Params$Resource$V2$Updatecmeksettings, options?: MethodOptions): GaxiosPromise<Schema$CmekSettings>;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
updateCmekSettings(params: Params$Resource$V2$Updatecmeksettings, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
updateCmekSettings(params: Params$Resource$V2$Updatecmeksettings, options: MethodOptions | BodyResponseCallback<Schema$CmekSettings>, callback: BodyResponseCallback<Schema$CmekSettings>): void;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
MethodDeclaration
updateCmekSettings(params: Params$Resource$V2$Updatecmeksettings, callback: BodyResponseCallback<Schema$CmekSettings>): void;
GumballWatterson00/DevCBatch1Project
node_modules/googleapis/build/src/apis/logging/v2.d.ts
TypeScript
ArrowFunction
(e, panzoom, scale) => { this.currentZoomLevel = scale; JsplumbBridge.setZoom(scale); JsplumbBridge.repaintEverything(); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
ArrowFunction
() => { if (this.currentModifiedPipelineId) { this.currentModifiedPipelineId = undefined; } this.clearAssembly(); this.TransitionService.makePipelineAssemblyEmpty(true); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
ArrowFunction
msg => { this.pipelineCached = false; this.pipelineCacheRunning = false; }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
ArrowFunction
msg => { if (msg.data !== "") { this.rawPipelineModel = msg.data; this.$timeout(() => { this.displayPipelineInEditor(true); }); } }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
ArrowFunction
() => { this.displayPipelineInEditor(true); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
ArrowFunction
(msg) => { let pipeline = msg.data; this.currentPipelineName = pipeline.name; this.currentPipelineDescription = pipeline.description; this.rawPipelineModel = this.JsplumbService.makeRawPipeline(pipeline, false); this.$timeout(() => { this.displayPipelineInEditor(true); }); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
ArrowFunction
pe => pe.settings.disabled
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
ClassDeclaration
export class PipelineAssemblyController { $timeout: any; $state: any; JsplumbService: any; PipelineEditorService: any; JsplumbBridge: any; ObjectProvider: any; DialogBuilder: any; EditorDialogManager: any; currentMouseOverElement: any; currentZoomLevel: any; preview: any; rawPipelineModel: any; PipelinePositioningService: any; PipelineValidationService: PipelineValidationService; RestApi: RestApi; selectMode: any; currentPipelineName: any; currentPipelineDescription: any; currentModifiedPipelineId: any; TransitionService: any; ShepherdService: any; errorMessagesDisplayed: any = false; pipelineValid: boolean = false; pipelineCacheRunning: boolean = false; pipelineCached: boolean = false; constructor(JsplumbBridge, PipelinePositioningService, EditorDialogManager, PipelineValidationService, ObjectProvider, RestApi, JsplumbService, $timeout, $state, TransitionService, ShepherdService) { this.JsplumbBridge = JsplumbBridge; this.PipelinePositioningService = PipelinePositioningService; this.EditorDialogManager = EditorDialogManager; this.PipelineValidationService = PipelineValidationService; this.ObjectProvider = ObjectProvider; this.RestApi = RestApi; this.JsplumbService = JsplumbService; this.$timeout = $timeout; this.$state = $state; this.TransitionService = TransitionService; this.ShepherdService = ShepherdService; this.selectMode = true; this.currentZoomLevel = 1; ($("#assembly") as any).panzoom({ disablePan: true, increment: 0.25, minScale: 0.5, maxScale: 1.5, contain: 'invert' }); $("#assembly").on('panzoomzoom', (e, panzoom, scale) => { this.currentZoomLevel = scale; JsplumbBridge.setZoom(scale); JsplumbBridge.repaintEverything(); }); } $onInit() { if (this.currentModifiedPipelineId) { this.displayPipelineById(); } else { this.checkAndDisplayCachedPipeline(); } } autoLayout() { this.PipelinePositioningService.layoutGraph("#assembly", "span[id^='jsplumb']", 110, false); this.JsplumbBridge.repaintEverything(); } toggleSelectMode() { if (this.selectMode) { ($("#assembly") as any).panzoom("option", "disablePan", false); ($("#assembly") as any).selectable("disable"); this.selectMode = false; } else { ($("#assembly") as any).panzoom("option", "disablePan", true); ($("#assembly") as any).selectable("enable"); this.selectMode = true; } } zoomOut() { this.doZoom(true); } zoomIn() { this.doZoom(false); } doZoom(zoomOut) { ($("#assembly") as any).panzoom("zoom", zoomOut); } showClearAssemblyConfirmDialog(ev) { this.EditorDialogManager.showClearAssemblyDialog(ev).then(() => { if (this.currentModifiedPipelineId) { this.currentModifiedPipelineId = undefined; } this.clearAssembly(); this.TransitionService.makePipelineAssemblyEmpty(true); }, function () { }); }; /** * clears the Assembly of all elements */ clearAssembly() { //$('#assembly').children().not('#clear, #submit').remove(); this.JsplumbBridge.deleteEveryEndpoint(); this.rawPipelineModel = []; ($("#assembly") as any).panzoom("reset", { disablePan: true, increment: 0.25, minScale: 0.5, maxScale: 1.5, contain: 'invert' }); this.currentZoomLevel = 1; this.JsplumbBridge.setZoom(this.currentZoomLevel); this.JsplumbBridge.repaintEverything(); this.RestApi.removePipelineFromCache().then(msg => { this.pipelineCached = false; this.pipelineCacheRunning = false; }); }; /** * Sends the pipeline to the server */ submit() { var pipeline = this.ObjectProvider.makeFinalPipeline(this.rawPipelineModel); pipeline.name = this.currentPipelineName; pipeline.description = this.currentPipelineDescription; if (this.currentModifiedPipelineId) { pipeline._id = this.currentModifiedPipelineId; } this.openPipelineNameModal(pipeline, (!!this.currentModifiedPipelineId)); } openPipelineNameModal(pipeline, modificationMode) { this.EditorDialogManager.showSavePipelineDialog(pipeline, modificationMode); } checkAndDisplayCachedPipeline() { this.RestApi.getCachedPipeline().then(msg => { if (msg.data !== "") { this.rawPipelineModel = msg.data; this.$timeout(() => { this.displayPipelineInEditor(true); }); } }); } displayPipelineById() { this.RestApi.getPipelineById(this.currentModifiedPipelineId) .then((msg) => { let pipeline = msg.data; this.currentPipelineName = pipeline.name; this.currentPipelineDescription = pipeline.description; this.rawPipelineModel = this.JsplumbService.makeRawPipeline(pipeline, false); this.$timeout(() => { this.displayPipelineInEditor(true); }); }); }; displayPipelineInEditor(autoLayout) { this.PipelinePositioningService.displayPipeline(this.rawPipelineModel, "#assembly", false, autoLayout); this.TransitionService.makePipelineAssemblyEmpty(false); this.pipelineValid = this.PipelineValidationService.isValidPipeline(this.rawPipelineModel); } toggleErrorMessagesDisplayed() { this.errorMessagesDisplayed = !(this.errorMessagesDisplayed); } isPipelineAssemblyEmpty() { return this.rawPipelineModel.length === 0 || this.rawPipelineModel.every(pe => pe.settings.disabled); } }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
$onInit() { if (this.currentModifiedPipelineId) { this.displayPipelineById(); } else { this.checkAndDisplayCachedPipeline(); } }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
autoLayout() { this.PipelinePositioningService.layoutGraph("#assembly", "span[id^='jsplumb']", 110, false); this.JsplumbBridge.repaintEverything(); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
toggleSelectMode() { if (this.selectMode) { ($("#assembly") as any).panzoom("option", "disablePan", false); ($("#assembly") as any).selectable("disable"); this.selectMode = false; } else { ($("#assembly") as any).panzoom("option", "disablePan", true); ($("#assembly") as any).selectable("enable"); this.selectMode = true; } }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
zoomOut() { this.doZoom(true); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
zoomIn() { this.doZoom(false); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
doZoom(zoomOut) { ($("#assembly") as any).panzoom("zoom", zoomOut); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
showClearAssemblyConfirmDialog(ev) { this.EditorDialogManager.showClearAssemblyDialog(ev).then(() => { if (this.currentModifiedPipelineId) { this.currentModifiedPipelineId = undefined; } this.clearAssembly(); this.TransitionService.makePipelineAssemblyEmpty(true); }, function () { }); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
/** * clears the Assembly of all elements */ clearAssembly() { //$('#assembly').children().not('#clear, #submit').remove(); this.JsplumbBridge.deleteEveryEndpoint(); this.rawPipelineModel = []; ($("#assembly") as any).panzoom("reset", { disablePan: true, increment: 0.25, minScale: 0.5, maxScale: 1.5, contain: 'invert' }); this.currentZoomLevel = 1; this.JsplumbBridge.setZoom(this.currentZoomLevel); this.JsplumbBridge.repaintEverything(); this.RestApi.removePipelineFromCache().then(msg => { this.pipelineCached = false; this.pipelineCacheRunning = false; }); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
/** * Sends the pipeline to the server */ submit() { var pipeline = this.ObjectProvider.makeFinalPipeline(this.rawPipelineModel); pipeline.name = this.currentPipelineName; pipeline.description = this.currentPipelineDescription; if (this.currentModifiedPipelineId) { pipeline._id = this.currentModifiedPipelineId; } this.openPipelineNameModal(pipeline, (!!this.currentModifiedPipelineId)); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
openPipelineNameModal(pipeline, modificationMode) { this.EditorDialogManager.showSavePipelineDialog(pipeline, modificationMode); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
checkAndDisplayCachedPipeline() { this.RestApi.getCachedPipeline().then(msg => { if (msg.data !== "") { this.rawPipelineModel = msg.data; this.$timeout(() => { this.displayPipelineInEditor(true); }); } }); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
displayPipelineById() { this.RestApi.getPipelineById(this.currentModifiedPipelineId) .then((msg) => { let pipeline = msg.data; this.currentPipelineName = pipeline.name; this.currentPipelineDescription = pipeline.description; this.rawPipelineModel = this.JsplumbService.makeRawPipeline(pipeline, false); this.$timeout(() => { this.displayPipelineInEditor(true); }); }); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
displayPipelineInEditor(autoLayout) { this.PipelinePositioningService.displayPipeline(this.rawPipelineModel, "#assembly", false, autoLayout); this.TransitionService.makePipelineAssemblyEmpty(false); this.pipelineValid = this.PipelineValidationService.isValidPipeline(this.rawPipelineModel); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
toggleErrorMessagesDisplayed() { this.errorMessagesDisplayed = !(this.errorMessagesDisplayed); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
MethodDeclaration
isPipelineAssemblyEmpty() { return this.rawPipelineModel.length === 0 || this.rawPipelineModel.every(pe => pe.settings.disabled); }
JLLeitschuh/incubator-streampipes
ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.controller.ts
TypeScript
ArrowFunction
() => { const g = new VisibilityGraph() g.AddVertexP(new Point(0, 0)) g.AddVertexP(new Point(0, 1)) const vv = [...g.Vertices()] expect(vv.length).toBe(2) }
microsoft/msagljs
modules/core/test/routing/visibility/VisibilityGraph.spec.ts
TypeScript
ArrowFunction
() => { const g = new VisibilityGraph() g.AddVertexP(new Point(0, 0)) g.AddVertexP(new Point(0, 1)) const v = g.FindVertex(new Point(0, 0)) expect(v.point.equal(new Point(0, 0))).toBe(true) const u = g.FindVertex(new Point(0, 0.5)) expect(u == undefined).toBe(true) g.RemoveVertex(v) }
microsoft/msagljs
modules/core/test/routing/visibility/VisibilityGraph.spec.ts
TypeScript
ArrowFunction
() => { const g = new VisibilityGraph() const a = new Point(0, 0) const b = new Point(1, 2) const c = new Point(5, 0) g.AddVertexP(a) g.AddVertexP(b) g.AddVertexP(c) const ab = g.AddEdgePP(a, b) const e_ab = g.FindEdgePP(a, b) expect(ab).toBe(e_ab) }
microsoft/msagljs
modules/core/test/routing/visibility/VisibilityGraph.spec.ts
TypeScript
FunctionDeclaration
/** * Adds new reaction to database */ export async function addReaction(reactionData: Reaction) { reactionData.created = new Date(); const add = await new Promise<boolean>((resolve, reject) => { db.collection("reactions").add(reactionData).then(response => { resolve(true); }).catch(error => { return reject(false); }) }); return add; }
ideaguy3d/wordmime-cms-template
server/db/reactions/addReaction.ts
TypeScript
ArrowFunction
(resolve, reject) => { db.collection("reactions").add(reactionData).then(response => { resolve(true); }).catch(error => { return reject(false); }) }
ideaguy3d/wordmime-cms-template
server/db/reactions/addReaction.ts
TypeScript
ArrowFunction
response => { resolve(true); }
ideaguy3d/wordmime-cms-template
server/db/reactions/addReaction.ts
TypeScript
ArrowFunction
error => { return reject(false); }
ideaguy3d/wordmime-cms-template
server/db/reactions/addReaction.ts
TypeScript
FunctionDeclaration
function renderClassMap(cssInfo: ClassInfo) { render(html`<div class="${classMap(cssInfo)}"></div>`, container); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
FunctionDeclaration
function renderClassMapStatic(cssInfo: ClassInfo) { render(html`<div class="aa ${classMap(cssInfo)} bb "></div>`, container); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { let container: HTMLDivElement; function renderClassMap(cssInfo: ClassInfo) { render(html`<div class="${classMap(cssInfo)}"></div>`, container); } function renderClassMapStatic(cssInfo: ClassInfo) { render(html`<div class="aa ${classMap(cssInfo)} bb "></div>`, container); } setup(() => { container = document.createElement('div'); }); test('adds classes', () => { renderClassMap({foo: 0, bar: true, zonk: true}); const el = container.firstElementChild!; assert.isFalse(el.classList.contains('foo')); assert.isTrue(el.classList.contains('bar')); assert.isTrue(el.classList.contains('zonk')); }); test('removes classes', () => { renderClassMap({foo: true, bar: true, baz: true}); const el = container.firstElementChild!; assert.isTrue(el.classList.contains('foo')); assert.isTrue(el.classList.contains('bar')); assert.isTrue(el.classList.contains('baz')); renderClassMap({foo: false, bar: true, baz: false}); assert.isFalse(el.classList.contains('foo')); assert.isTrue(el.classList.contains('bar')); assert.isFalse(el.classList.contains('baz')); }); test('removes omitted classes', () => { renderClassMap({foo: true, bar: true, baz: true}); const el = container.firstElementChild!; assert.isTrue(el.classList.contains('foo')); assert.isTrue(el.classList.contains('bar')); assert.isTrue(el.classList.contains('baz')); renderClassMap({}); assert.isFalse(el.classList.contains('foo')); assert.isFalse(el.classList.contains('bar')); assert.isFalse(el.classList.contains('baz')); assert.equal(el.classList.length, 0); }); test('works with static classes', () => { renderClassMapStatic({foo: true}); const el = container.firstElementChild!; assert.isTrue(el.classList.contains('aa')); assert.isTrue(el.classList.contains('bb')); assert.isTrue(el.classList.contains('foo')); renderClassMapStatic({}); assert.isTrue(el.classList.contains('aa')); assert.isTrue(el.classList.contains('bb')); assert.isFalse(el.classList.contains('foo')); }); test('throws when used on non-class attribute', () => { assert.throws(() => { render(html`<div id="${classMap({})}"></div>`, container); }); }); test('throws when used in attribute with more than 1 part', () => { assert.throws(() => { render(html`<div class="${'hi'} ${classMap({})}"></div>`, container); }); }); test('throws when used in NodePart', () => { assert.throws(() => { render(html`<div>${classMap({})}</div>`, container); }); }); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { container = document.createElement('div'); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { renderClassMap({foo: 0, bar: true, zonk: true}); const el = container.firstElementChild!; assert.isFalse(el.classList.contains('foo')); assert.isTrue(el.classList.contains('bar')); assert.isTrue(el.classList.contains('zonk')); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { renderClassMap({foo: true, bar: true, baz: true}); const el = container.firstElementChild!; assert.isTrue(el.classList.contains('foo')); assert.isTrue(el.classList.contains('bar')); assert.isTrue(el.classList.contains('baz')); renderClassMap({foo: false, bar: true, baz: false}); assert.isFalse(el.classList.contains('foo')); assert.isTrue(el.classList.contains('bar')); assert.isFalse(el.classList.contains('baz')); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { renderClassMap({foo: true, bar: true, baz: true}); const el = container.firstElementChild!; assert.isTrue(el.classList.contains('foo')); assert.isTrue(el.classList.contains('bar')); assert.isTrue(el.classList.contains('baz')); renderClassMap({}); assert.isFalse(el.classList.contains('foo')); assert.isFalse(el.classList.contains('bar')); assert.isFalse(el.classList.contains('baz')); assert.equal(el.classList.length, 0); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { renderClassMapStatic({foo: true}); const el = container.firstElementChild!; assert.isTrue(el.classList.contains('aa')); assert.isTrue(el.classList.contains('bb')); assert.isTrue(el.classList.contains('foo')); renderClassMapStatic({}); assert.isTrue(el.classList.contains('aa')); assert.isTrue(el.classList.contains('bb')); assert.isFalse(el.classList.contains('foo')); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { assert.throws(() => { render(html`<div id="${classMap({})}"></div>`, container); }); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { render(html`<div id="${classMap({})}"></div>`, container); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { assert.throws(() => { render(html`<div class="${'hi'} ${classMap({})}"></div>`, container); }); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { render(html`<div class="${'hi'} ${classMap({})}"></div>`, container); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { assert.throws(() => { render(html`<div>${classMap({})}</div>`, container); }); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ArrowFunction
() => { render(html`<div>${classMap({})}</div>`, container); }
Alexendoo/lit-html
src/test/directives/classMap_test.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-navbar', templateUrl: './navbar.component.html', styleUrls: ['./navbar.component.scss'], encapsulation: ViewEncapsulation.None }) export class NavbarComponent implements OnInit { constructor(private authService: AuthService) { } ngOnInit() { } }
dimashmundiak/TripBook
TripBook/TripBook.Client/src/app/components/navbar/navbar.component.ts
TypeScript
ArrowFunction
() => { const url = window.location.href.includes('app-q0') ? 'https://app-q0.adeo.no/veilarbpersonflatefs/' : 'https://app.adeo.no/veilarbpersonflatefs/'; return ( <Alertstripe type="advarsel" className={cls.block}> <Element>Vi har flyttet tilretteleggingsbehovene</Element>Fra nå av skal du fylle inn tilretteleggingsbehov under <b>Detaljer</b> i <b>Aktivitsplanen</b>. <div className={cls.element('lenke')}> <Lenke href={url}> Gå til enhetens oversikt og velg bruker for å registrere tilretteleggingbehov. </Lenke> </div> </Alertstripe> ); }
navikt/finn-kandidat
src/pages/forside/tilretteleggingsbehov-flyttet-info/TilretteleggingsbehovFlyttetInfo.tsx
TypeScript
ArrowFunction
(value: any): string => { if (value === null) return 'null'; if (value === undefined) return 'undefined'; if (typeof value === 'number') return '' + value; if (typeof value === 'boolean') return '' + value; if (typeof value === 'string') return `'${value.replace("'", "\\'")}'`; if (typeof value === 'bigint') return '' + value; if (typeof value === 'function') return value.toString(); if (Array.isArray(value)) return `[${value.map(tsValueString).join(',')}]`; if (typeof value === 'object') { const keyValues = Object.entries(value) .map(([key, value]) => [key, tsValueString(value)]) .map(([key, value]) => `${key}: ${value}`) .join(','); return `{${keyValues}}`; } throw new SasatError(`tsValueString::unsupported data type ${typeof value}`); }
yanokunpei/sassat
src/generator/ts/tsValueString.ts
TypeScript
ArrowFunction
([key, value]) => [key, tsValueString(value)]
yanokunpei/sassat
src/generator/ts/tsValueString.ts
TypeScript
ArrowFunction
([key, value]) => `${key}: ${value}`
yanokunpei/sassat
src/generator/ts/tsValueString.ts
TypeScript
FunctionDeclaration
export function makeTimeframeDayOfMonth(item: { sql_timestamp: string; connection: api.ProjectConnectionEnum; }) { let sql; if (item.connection === api.ProjectConnectionEnum.BigQuery) { sql = `EXTRACT(DAY FROM ${item.sql_timestamp})`; } else if (item.connection === api.ProjectConnectionEnum.PostgreSQL) { sql = `EXTRACT(DAY FROM ${item.sql_timestamp})`; } return sql; }
rc-ontruck/mprove
blockml/src/models/gen/make-timeframe-day-of-month.ts
TypeScript
ClassDeclaration
export class Message { constructor( private readonly _name: string, private readonly _email: Email, private readonly _message: string ) {} get name(): string { return this._name; } get email(): string { return this._email.value; } get message(): string { return this._message; } }
AlexSamarkin/alexsamarkin.com-server
src/domain/entities/message.ts
TypeScript
ArrowFunction
(Vue: VueConstructor) => { components.forEach(Component => { Vue.use(Component); }); }
qicainiao/gitversiondemo
src/index.ts
TypeScript
ArrowFunction
Component => { Vue.use(Component); }
qicainiao/gitversiondemo
src/index.ts
TypeScript
InterfaceDeclaration
interface Window { Vue?: VueConstructor; }
qicainiao/gitversiondemo
src/index.ts
TypeScript
ClassDeclaration
@Module({ imports: [ PassportModule.register({ defaultStrategy: 'jwt' }), JwtModule.register({ secret: process.env.JWT_SECRET || jwtConfig.secret, signOptions: { expiresIn: jwtConfig.expiresIn, }, }), TypeOrmModule.forFeature([UserRepository]), ], controllers: [AuthController], providers: [AuthService, JwtStrategy], exports: [JwtStrategy, PassportModule], }) export class AuthModule {}
loxt/nestjs-task-management
src/auth/auth.module.ts
TypeScript
ArrowFunction
() => { const { query, push } = useRouter(); const configurations = useAppSelector( getConfigurationByController(parseInt(query.controllerId as string, 10)), ); const controller = useAppSelector(getDownloadController); const isLoading = useAppSelector(isControllerByIdLoading); const dispatch = useAppDispatch(); useEffect(() => { if (query.controllerId) { dispatch(fetchControllerById(parseInt(query.controllerId as string, 10))); dispatch(fetchConfigurationsByController(parseInt(query.controllerId as string, 10))); } }, [query]); const handleConfigurationClick = (configId: number) => { dispatch(addConfiguration(configId)); push(`/controllers/${query.controllerId}/${configId}`); }; return ( <StepsPage> <Head> <title>CSI-Stash :: Controllers</title> </Head> <h2>Configuration</h2> <Layout columns="2fr 1fr"> <section> {/* {configLoading && ( <div>Loading......</div> )} */} {!configurations && ( <div>No configurations yet</div>
navelpluisje/csi-stash
src/pages/controllers/[controllerId]/index.tsx
TypeScript
ArrowFunction
() => { if (query.controllerId) { dispatch(fetchControllerById(parseInt(query.controllerId as string, 10))); dispatch(fetchConfigurationsByController(parseInt(query.controllerId as string, 10))); } }
navelpluisje/csi-stash
src/pages/controllers/[controllerId]/index.tsx
TypeScript
ArrowFunction
(configId: number) => { dispatch(addConfiguration(configId)); push(`/controllers/${query.controllerId}/${configId}`); }
navelpluisje/csi-stash
src/pages/controllers/[controllerId]/index.tsx
TypeScript
FunctionDeclaration
export default function groupBy2<T, K extends string | number>(list: T[], iteratee: (t: T) => K) { const groups = new Map<K, T[]>() for (const item of list) { const key = iteratee(item) if (!groups.has(key)) { groups.set(key, []) } groups.get(key).push(item) } return groups }
GZ315200/ali-react-table
packages/ali-react-table/src/utils/groupBy2.ts
TypeScript
ArrowFunction
() => { const { installed, connect } = useWallet() const contents = !installed ? { action: ( <ExtLink href={EXTENSION}>{MESSAGE.Wallet.DownloadExtension}</ExtLink>
Terra-pool/terra-pool-ui
src/containers/ConnectionRequired.tsx
TypeScript
ClassDeclaration
export class FakeState<T> implements State<T> { private data?: T; constructor( private readonly empty: T, ) { } public async get(): Promise<T> { if (!this.data) { return this.empty; } return deepMergeObject(this.empty, this.data); } public async store(data: T): Promise<void> { this.data = data; } }
schrodit/gardener-helm-installation
src/ts/state/FakeState.ts
TypeScript
ClassDeclaration
export class FakeKeyValueState<T> implements KeyValueState<T> { private data: Record<string, T> = {}; public async getAll(): Promise<Record<string, T>> { return this.data; } public async get(key: string): Promise<T | undefined> { return this.data[key]; } public async store(key: string, data: T): Promise<void> { this.data[key] = data; } }
schrodit/gardener-helm-installation
src/ts/state/FakeState.ts
TypeScript
MethodDeclaration
public async get(): Promise<T> { if (!this.data) { return this.empty; } return deepMergeObject(this.empty, this.data); }
schrodit/gardener-helm-installation
src/ts/state/FakeState.ts
TypeScript
MethodDeclaration
public async store(data: T): Promise<void> { this.data = data; }
schrodit/gardener-helm-installation
src/ts/state/FakeState.ts
TypeScript
MethodDeclaration
public async getAll(): Promise<Record<string, T>> { return this.data; }
schrodit/gardener-helm-installation
src/ts/state/FakeState.ts
TypeScript
MethodDeclaration
public async get(key: string): Promise<T | undefined> { return this.data[key]; }
schrodit/gardener-helm-installation
src/ts/state/FakeState.ts
TypeScript
MethodDeclaration
public async store(key: string, data: T): Promise<void> { this.data[key] = data; }
schrodit/gardener-helm-installation
src/ts/state/FakeState.ts
TypeScript
ClassDeclaration
@Component({ selector: 'mesh-schema-label', templateUrl: './schema-label.component.html', styleUrls: ['./schema-label.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) export class SchemaLabelComponent { @Input() schema: SchemaReference | Schema | undefined; getSchemaName(): string { if (!this.schema) { return ''; } return this.schema.name || this.schema.uuid; } }
darioseidl/mesh-ui
src/app/shared/components/schema-label/schema-label.component.ts
TypeScript
MethodDeclaration
getSchemaName(): string { if (!this.schema) { return ''; } return this.schema.name || this.schema.uuid; }
darioseidl/mesh-ui
src/app/shared/components/schema-label/schema-label.component.ts
TypeScript
ClassDeclaration
export default class extends Inhibitor { async run(msg: KlasaMessage) { if (!msg.guild) return; if (msg.guild.settings.get(GuildSettings.StaffOnlyChannels).includes(msg.channel.id)) { const hasPerm = await msg.hasAtLeastPermissionLevel(6); if (!hasPerm) throw true; } } }
BrandonEnglish848/oldschoolbot
src/inhibitors/onlyStaffCanUseCommands.ts
TypeScript
MethodDeclaration
async run(msg: KlasaMessage) { if (!msg.guild) return; if (msg.guild.settings.get(GuildSettings.StaffOnlyChannels).includes(msg.channel.id)) { const hasPerm = await msg.hasAtLeastPermissionLevel(6); if (!hasPerm) throw true; } }
BrandonEnglish848/oldschoolbot
src/inhibitors/onlyStaffCanUseCommands.ts
TypeScript
ArrowFunction
() => Sizes
abrambagus/ReactNative-Fashion-BE
src/product/models/dto/product-update.dto.ts
TypeScript
ClassDeclaration
class Sizes { @IsOptional() name?: string; }
abrambagus/ReactNative-Fashion-BE
src/product/models/dto/product-update.dto.ts
TypeScript
ClassDeclaration
export class ProductUpdateDto { @IsOptional() @IsString() name?: string; @IsOptional() @IsString() brand?: string; @IsOptional() @IsString() description?: string; @IsOptional() @IsInt() price?: number; @IsOptional() @IsArray() @ValidateNested({ each: true }) @Type(() => Sizes) sizes?: Sizes[]; }
abrambagus/ReactNative-Fashion-BE
src/product/models/dto/product-update.dto.ts
TypeScript
ArrowFunction
() => { let occConfiguratorUpdateCartEntrySerializer: OccConfiguratorTextfieldUpdateCartEntrySerializer; const USER_ID = 'theUser'; const CART_ID = '98876'; const LABEL1 = 'LABEL1'; const VALUE1 = 'VALUE1'; const TEXTFIELD = 'TEXTFIELD'; const CART_ENTRY_NUMBER = '2'; const configuration: ConfiguratorTextfield.Configuration = { configurationInfos: [ { configurationLabel: LABEL1, configurationValue: VALUE1, status: ConfiguratorTextfield.ConfigurationStatus.SUCCESS, }, ], }; const sourceParameters: ConfiguratorTextfield.UpdateCartEntryParameters = { userId: USER_ID, cartId: CART_ID, cartEntryNumber: CART_ENTRY_NUMBER, configuration: configuration, }; beforeEach(() => { TestBed.configureTestingModule({ providers: [OccConfiguratorTextfieldUpdateCartEntrySerializer], }); occConfiguratorUpdateCartEntrySerializer = TestBed.inject( OccConfiguratorTextfieldUpdateCartEntrySerializer as Type< OccConfiguratorTextfieldUpdateCartEntrySerializer > ); }); it('should convert updateCartEntry parameters', () => { const convertedParameters = occConfiguratorUpdateCartEntrySerializer.convert( sourceParameters ); expect(convertedParameters.userId).toEqual(sourceParameters.userId); expect(convertedParameters.configurationInfos[0].configuratorType).toEqual( TEXTFIELD ); expect( convertedParameters.configurationInfos[0].configurationLabel ).toEqual( sourceParameters.configuration.configurationInfos[0].configurationLabel ); }); }
Changsuwan/spartacus
feature-libs/product-configurator/textfield/occ/converters/occ-configurator-textfield-update-cart-entry-serializer.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ providers: [OccConfiguratorTextfieldUpdateCartEntrySerializer], }); occConfiguratorUpdateCartEntrySerializer = TestBed.inject( OccConfiguratorTextfieldUpdateCartEntrySerializer as Type< OccConfiguratorTextfieldUpdateCartEntrySerializer > ); }
Changsuwan/spartacus
feature-libs/product-configurator/textfield/occ/converters/occ-configurator-textfield-update-cart-entry-serializer.spec.ts
TypeScript
ArrowFunction
() => { const convertedParameters = occConfiguratorUpdateCartEntrySerializer.convert( sourceParameters ); expect(convertedParameters.userId).toEqual(sourceParameters.userId); expect(convertedParameters.configurationInfos[0].configuratorType).toEqual( TEXTFIELD ); expect( convertedParameters.configurationInfos[0].configurationLabel ).toEqual( sourceParameters.configuration.configurationInfos[0].configurationLabel ); }
Changsuwan/spartacus
feature-libs/product-configurator/textfield/occ/converters/occ-configurator-textfield-update-cart-entry-serializer.spec.ts
TypeScript
ArrowFunction
() => { const doc = $$.dom.createDocument('myns', 'root') if (!doc.documentElement) throw new Error("documentElement is null") const node1 = doc.createTextNode('data') const node2 = doc.createTextNode('data') doc.documentElement.appendChild(node1) doc.documentElement.appendChild(node2) test('constructor()', () => { expect(node1.data).toBe('data') }) test('isEqualNode()', () => { expect(node1.isEqualNode(node2)).toBe(true) expect(node1.isEqualNode()).toBe(false) }) test('nodeValue, textContent, data', () => { expect(node1.nodeValue).toBe('data') expect(node1.textContent).toBe('data') expect(node1.data).toBe('data') node1.nodeValue = 'new data' expect(node1.nodeValue).toBe('new data') expect(node1.textContent).toBe('new data') expect(node1.data).toBe('new data') node1.textContent = 'other data' expect(node1.nodeValue).toBe('other data') expect(node1.textContent).toBe('other data') expect(node1.data).toBe('other data') node1.data = 'old data' expect(node1.nodeValue).toBe('old data') expect(node1.textContent).toBe('old data') expect(node1.data).toBe('old data') // assign null node1.nodeValue = null expect(node1.data).toBe('') node1.data = 'data' node1.textContent = null expect(node1.data).toBe('') node1.data = 'data' }) test('length', () => { expect(node1.length).toBe(4) }) test('appendData', () => { node1.appendData(' or data') expect(node1.data).toBe('data or data') node1.data = 'data' }) test('insertData', () => { node1.insertData(2, 'da') expect(node1.data).toBe('dadata') node1.data = 'data' }) test('deleteData', () => { node1.data = 'a long night' node1.deleteData(2, 5) expect(node1.data).toBe('a night') expect(() => node1.deleteData(20, 1)).toThrow() node1.deleteData(1, 60) expect(node1.data).toBe('a') node1.data = 'data' }) test('deleteData updates live range', () => { const range = new $$.Range() node1.data = 'aaxxxaa' range.setStart(node1, 1) range.setEnd(node1, 4) node1.deleteData(2, 3) expect(node1.data).toBe('aaaa') expect(range.startOffset).toBe(1) expect(range.endOffset).toBe(2) node1.data = 'aaxxxaa' range.setStart(node1, 3) range.setEnd(node1, 6) node1.deleteData(2, 3) expect(node1.data).toBe('aaaa') expect(range.startOffset).toBe(2) expect(range.endOffset).toBe(3) node1.data = 'aaxxxaa' range.setStart(node1, 6) range.setEnd(node1, 7) node1.deleteData(2, 3) expect(node1.data).toBe('aaaa') expect(range.startOffset).toBe(3) expect(range.endOffset).toBe(4) node1.data = 'data' }) test('replaceData', () => { node1.data = 'a long night' node1.replaceData(2, 4, 'starry') expect(node1.data).toBe('a starry night') node1.data = 'data' }) test('substringData', () => { node1.data = 'a long night' expect(node1.substringData(2, 4)).toBe('long') expect(() => node1.substringData(20, 4)).toThrow() expect(node1.substringData(2, 40)).toBe('long night') node1.data = 'data' }) test('mutation observer', (done) => { node1.data = 'a long night' const callback = (mutations: MutationRecord[]) => { try { for (let mutation of mutations) { if (mutation.type === 'characterData') { expect(mutation.target).toBe(node1) expect([...mutation.addedNodes]).toEqual([]) expect([...mutation.removedNodes]).toEqual([]) expect(mutation.previousSibling).toBeNull() expect(mutation.nextSibling).toBeNull() expect(mutation.oldValue).toBe('a long night') done() } } done() } catch (e) { done(e) } } const observer = new $$.MutationObserver(callback) observer.observe(node1, { characterData: true, characterDataOldValue: true }) node1.deleteData(2, 5) const records = observer.takeRecords() if (records) callback(records) observer.disconnect() node1.data = 'data' }) test('mutation observer without setting', (done) => { node1.data = 'a long night' let fired = false const callback = (mutations: MutationRecord[]) => { for (let mutation of mutations) { if (mutation.type === 'characterData' && mutation.target === node1) { fired = true } } done() } const observer = new $$.MutationObserver(callback) observer.observe(node1, { characterData: true, characterDataOldValue: true }) dom.setFeatures(false) node1.deleteData(2, 5) dom.setFeatures(true) const records = observer.takeRecords() if (records) callback(records) observer.disconnect() node1.data = 'data' expect(fired).toBe(false) }) }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => { expect(node1.data).toBe('data') }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => { expect(node1.isEqualNode(node2)).toBe(true) expect(node1.isEqualNode()).toBe(false) }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => { expect(node1.nodeValue).toBe('data') expect(node1.textContent).toBe('data') expect(node1.data).toBe('data') node1.nodeValue = 'new data' expect(node1.nodeValue).toBe('new data') expect(node1.textContent).toBe('new data') expect(node1.data).toBe('new data') node1.textContent = 'other data' expect(node1.nodeValue).toBe('other data') expect(node1.textContent).toBe('other data') expect(node1.data).toBe('other data') node1.data = 'old data' expect(node1.nodeValue).toBe('old data') expect(node1.textContent).toBe('old data') expect(node1.data).toBe('old data') // assign null node1.nodeValue = null expect(node1.data).toBe('') node1.data = 'data' node1.textContent = null expect(node1.data).toBe('') node1.data = 'data' }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => { expect(node1.length).toBe(4) }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => { node1.appendData(' or data') expect(node1.data).toBe('data or data') node1.data = 'data' }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => { node1.insertData(2, 'da') expect(node1.data).toBe('dadata') node1.data = 'data' }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => { node1.data = 'a long night' node1.deleteData(2, 5) expect(node1.data).toBe('a night') expect(() => node1.deleteData(20, 1)).toThrow() node1.deleteData(1, 60) expect(node1.data).toBe('a') node1.data = 'data' }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => node1.deleteData(20, 1)
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript
ArrowFunction
() => { const range = new $$.Range() node1.data = 'aaxxxaa' range.setStart(node1, 1) range.setEnd(node1, 4) node1.deleteData(2, 3) expect(node1.data).toBe('aaaa') expect(range.startOffset).toBe(1) expect(range.endOffset).toBe(2) node1.data = 'aaxxxaa' range.setStart(node1, 3) range.setEnd(node1, 6) node1.deleteData(2, 3) expect(node1.data).toBe('aaaa') expect(range.startOffset).toBe(2) expect(range.endOffset).toBe(3) node1.data = 'aaxxxaa' range.setStart(node1, 6) range.setEnd(node1, 7) node1.deleteData(2, 3) expect(node1.data).toBe('aaaa') expect(range.startOffset).toBe(3) expect(range.endOffset).toBe(4) node1.data = 'data' }
oozcitak/dom
test/dom/CharacterData.test.ts
TypeScript