本文整理汇总了TypeScript中@phosphor/algorithm.ArrayExt类的典型用法代码示例。如果您正苦于以下问题:TypeScript ArrayExt类的具体用法?TypeScript ArrayExt怎么用?TypeScript ArrayExt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArrayExt类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should be reset when loading from disk', () => {
let model = new NotebookModel();
let cell = model.contentFactory.createCodeCell({});
model.cells.pushBack(cell);
model.fromJSON(DEFAULT_CONTENT);
expect(ArrayExt.firstIndexOf(toArray(model.cells), cell)).to.be(-1);
expect(model.cells.length).to.be(6);
});
示例2: it
it('adjust after inserting an item', function() {
const insertedValue = 'value-before-1';
ArrayExt.insert(sequence, 1, insertedValue);
// sequence is now [value-0, value-before-1, value-1]
selection.adjustSelectionForInsert(1, insertedValue);
expect(selection.index).to.equal(1);
expect(selection.value).to.equal(insertedValue);
});
示例3: _resolve
/**
* Resolve a button item.
*/
private _resolve(item: Dialog.IButton): void {
// Prevent loopback.
let promise = this._promise;
this._promise = null;
this.close();
ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);
promise.resolve(item);
}
示例4: it
it('should be reset when loading from disk', () => {
const model = new NotebookModel();
const cell = model.contentFactory.createCodeCell({});
model.cells.push(cell);
model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
expect(ArrayExt.firstIndexOf(toArray(model.cells), cell)).to.equal(-1);
expect(model.cells.length).to.equal(6);
});
示例5: dispose
/**
* Dispose of the resources used by the dialog.
*/
dispose(): void {
const promise = this._promise;
if (promise) {
this._promise = null;
promise.reject(void 0);
ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);
}
super.dispose();
}
示例6: hitTestNodes
export function hitTestNodes(
nodes: HTMLElement[] | HTMLCollection,
x: number,
y: number
): number {
return ArrayExt.findFirstIndex(nodes, node => {
return ElementExt.hitTest(node, x, y);
});
}
示例7: dispose
/**
* Dispose of the resources used by the dialog.
*/
dispose(): void {
if (this._promise) {
let promise = this._promise;
this._promise = null;
promise.resolve(void 0);
ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);
}
super.dispose();
}
示例8: _evtDragEnter
/**
* Handle the `'p-dragenter'` event for the widget.
*/
private _evtDragEnter(event: IDragEvent): void {
if (event.mimeData.hasData(CONTENTS_MIME)) {
let index = ArrayExt.findFirstIndex(this._crumbs, node => ElementExt.hitTest(node, event.clientX, event.clientY));
if (index !== -1) {
if (index !== Private.Crumb.Current) {
this._crumbs[index].classList.add(DROP_TARGET_CLASS);
event.preventDefault();
event.stopPropagation();
}
}
}
}
示例9: it
it('should remove a group from the menu', () => {
const group1 = [ { command: 'run1'}, { command: 'run2' }];
const group2 = [ { command: 'run3'}, { command: 'run4' }];
menu.addGroup(group1);
menu.addGroup(group2);
menu.removeGroup(group1);
let idx1 = ArrayExt.findFirstIndex(menu.menu.items,
m => m.command === 'run1');
let idx2 = ArrayExt.findFirstIndex(menu.menu.items,
m => m.command === 'run2');
let idx3 = ArrayExt.findFirstIndex(menu.menu.items,
m => m.command === 'run3');
let idx4 = ArrayExt.findFirstIndex(menu.menu.items,
m => m.command === 'run4');
expect(idx1).to.be(-1);
expect(idx2).to.be(-1);
expect(idx3 === -1).to.be(false);
expect(idx4 === -1).to.be(false);
});
示例10: it
it('adjust after removing the selected item', function() {
ArrayExt.removeAt(sequence, 1);
selection.adjustSelectionForRemove(1, 'value-1');
expect(selection.index).to.equal(0);
expect(selection.value).to.equal('value-0');
const message = getLastMessage(subscriber);
expect(message).to.deep.equal({
previousIndex: 1,
previousValue: 'value-1',
currentIndex: 0,
currentValue: 'value-0'
});
});