本文整理汇总了TypeScript中external/gs_tools/src/immutable.ImmutableList.of方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ImmutableList.of方法的具体用法?TypeScript ImmutableList.of怎么用?TypeScript ImmutableList.of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类external/gs_tools/src/immutable.ImmutableList
的用法示例。
在下文中一共展示了ImmutableList.of方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should set the correct target element to active', () => {
const rootEl = Mocks.object('rootEl');
const fullPath = 'fullPath';
const slotName = 'slotName';
const path = 'path';
const childWithPath = document.createElement('div');
childWithPath.setAttribute('gs-view-path', path);
childWithPath.setAttribute('slot', slotName);
const childNoPath = document.createElement('div');
const element = document.createElement('div');
element.appendChild(childNoPath);
element.appendChild(childWithPath);
element[__fullPath] = fullPath;
const appendedPath = 'appendedPath';
spyOn(LocationService, 'appendParts').and.returnValue(appendedPath);
spyOn(LocationService, 'hasMatch').and.returnValue(true);
spyOn(viewSlot, 'setRootElVisible_');
const fakeSwitchValueSetter = new FakeMonadSetter<string | null>(null);
const updates = viewSlot.updateActiveView_(element, rootEl, fakeSwitchValueSetter);
assert(fakeSwitchValueSetter.findValue(updates)!.value).to.equal(slotName);
assert(viewSlot['setRootElVisible_']).to.haveBeenCalledWith(rootEl, true);
assert(LocationService.appendParts).to.haveBeenCalledWith(ImmutableList.of([fullPath, path]));
assert(LocationService.hasMatch).to.haveBeenCalledWith(appendedPath);
assert(childWithPath.getAttribute('gs-view-active')).to.equal('true');
});
示例2: it
it('should return true if every item has one of the specified mime type', () => {
const mimeType1 = 'mimeType1';
const mimeType2 = 'mimeType2';
const dataTransfer = Mocks.object('dataTransfer');
dataTransfer.items = [{type: mimeType1}, {type: mimeType2}];
assert(input['isValid_'](ImmutableList.of([mimeType1, mimeType2]), dataTransfer)).to.beTrue();
});
示例3: getCascadePaths
/**
* @param params Params to create the paths.
* @return Array of paths for the current route and its ancestors. The oldest ancestors come
* first in the array.
*/
getCascadePaths(params: CR): string[] {
const paths: string[] = [];
let current: AbstractRouteFactory<any, any, any, any> | null = this;
while (current !== null) {
paths.push(current.getPath(params));
current = current.parent_;
}
return [...ImmutableList.of(paths).reverse()];
}
示例4: getCascadeNames
/**
* @param params Params to determine the name of the route.
* @return Array of names of the current route and its ancestors. The oldest ancestors come
* first in the array.
*/
getCascadeNames(params: CR): Promise<string>[] {
const names: Promise<string>[] = [];
let current: AbstractRouteFactory<any, any, any, any> | null = this;
while (current !== null) {
names.push(current.getName(params));
current = current.parent_;
}
return [...ImmutableList.of(names).reverse()];
}
示例5: getCascadeCrumbs
async getCascadeCrumbs(params: CR): Promise<{name: string, url: string}[]> {
const crumbs: {name: string, url: string}[] = [];
let current: AbstractRouteFactory<any, any, any, any> | null = this;
while (current !== null) {
crumbs.push({
name: await current.getName(params),
url: current.getPath(params),
});
current = current.parent_;
}
return [...ImmutableList.of(crumbs).reverse()];
}
示例6: it
it(`should return the correct map`, () => {
const type1 = Mocks.object('type1');
const mockFactory1 = jasmine.createSpyObj('Factory1', ['getType']);
mockFactory1.getType.and.returnValue(type1);
const type2 = Mocks.object('type2');
const mockFactory2 = jasmine.createSpyObj('Factory2', ['getType']);
mockFactory2.getType.and.returnValue(type2);
const routeFactories = ImmutableList.of([mockFactory1, mockFactory2]);
assert(providesRouteFactoryMap(routeFactories)).to.haveElements([
[type1, mockFactory1],
[type2, mockFactory2],
]);
});