本文整理汇总了TypeScript中external/gs_tools/src/testing.TestDispose.add方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestDispose.add方法的具体用法?TypeScript TestDispose.add怎么用?TypeScript TestDispose.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类external/gs_tools/src/testing.TestDispose
的用法示例。
在下文中一共展示了TestDispose.add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(() => {
mockRouteService = Mocks.listenable('RouteService');
TestDispose.add(mockRouteService);
const mockThemeService = jasmine.createSpyObj('ThemeService', ['applyTheme']);
breadcrumb = new Breadcrumb(mockThemeService);
TestDispose.add(breadcrumb);
});
示例2: beforeEach
beforeEach(() => {
mockDocument = jasmine.createSpyObj('Document', ['createElement', 'querySelector']);
mockTemplates = jasmine.createSpyObj('Templates', ['getTemplate']);
mockWindow = jasmine.createSpyObj('Window', ['getComputedStyle']);
service = new ThemeService(mockTemplates, mockWindow, mockDocument);
TestDispose.add(service);
});
示例3: beforeEach
beforeEach(() => {
const injector = Mocks.object('injector');
mockThemeService = jasmine.createSpyObj('ThemeService', ['applyTheme', 'install']);
mockRegistrar = jasmine.createSpyObj('Registrar', ['register']);
main = new Main(injector, mockThemeService, mockRegistrar);
TestDispose.add(main);
});
示例4: it
it('should set up correctly', () => {
const ace = Mocks.object('ace');
const routeFactoryServiceCtor = Mocks.object('routeFactoryServiceCtor');
const templates = Mocks.object('templates');
spyOn(Templates, 'newInstance').and.returnValue(templates);
const mockThemeService = jasmine.createSpyObj('ThemeService', ['initialize', 'install']);
const factories = Mocks.object('factories');
const mockRouteFactoryService = jasmine.createSpyObj('RouteFactoryService', ['getFactories']);
mockRouteFactoryService.getFactories.and.returnValue(factories);
const mockInjector = jasmine.createSpyObj('Injector', ['bindProvider', 'getBoundValue']);
Fakes.build(mockInjector.getBoundValue)
.when('theming.ThemeService').return(mockThemeService)
.when('x.gs_ui.routeFactoryService').return(mockRouteFactoryService);
spyOn(Injector, 'newInstance').and.returnValue(mockInjector);
const mockRegistrar = jasmine.createSpyObj('Registrar', ['register']);
spyOn(ElementRegistrar, 'newInstance').and.returnValue(mockRegistrar);
spyOn(Persona, 'registerAll');
const main = Main.newInstance({
ace: ace,
routeFactoryServiceCtor: routeFactoryServiceCtor,
});
TestDispose.add(main);
assert(main['injector_']).to.equal(mockInjector);
assert(main['themeService_']).to.equal(mockThemeService);
assert(main['registrar_']).to.equal(mockRegistrar);
assert(mockThemeService.initialize).to.haveBeenCalledWith();
assert(mockInjector.getBoundValue).to.haveBeenCalledWith('theming.ThemeService');
assert(ElementRegistrar.newInstance).to.haveBeenCalledWith(mockInjector, templates);
assert(TestInject.getBoundValue('x.dom.document')()).to.equal(document);
assert(TestInject.getBoundValue('x.dom.window')()).to.equal(window);
assert(TestInject.getBoundValue('x.gs_tools.templates')()).to.equal(templates);
assert(TestInject.getBoundValue('x.gs_ui.routeFactoryService'))
.to.equal(routeFactoryServiceCtor);
assert(TestInject.getBoundValue('x.ace')()).to.equal(ace);
assert(Templates.newInstance).to.haveBeenCalledWith();
assert(Persona.registerAll).to.haveBeenCalledWith(mockInjector, templates);
});
示例5: it
it(`should do nothing if the target element cannot be found`, async () => {
const triggeredBy = 'triggeredBy';
spyOn(Persona, 'getValue').and.returnValue(triggeredBy);
const origDisposable = DisposableFunction.of(() => undefined);
Graph.createProvider($triggeredByRegistration, origDisposable);
TestDispose.add(origDisposable);
const mockRootNode = jasmine.createSpyObj('RootNode', ['querySelector']);
Object.setPrototypeOf(mockRootNode, Element.prototype);
mockRootNode.querySelector.and.returnValue(null);
const mockElement = jasmine.createSpyObj('Element', ['getRootNode']);
mockElement.getRootNode.and.returnValue(mockRootNode);
Object.setPrototypeOf(mockElement, HTMLElement.prototype);
await Graph.createProvider($.host.el.getId(), mockElement);
await menu.onTriggeredByChanged_();
assert(mockRootNode.querySelector).to.haveBeenCalledWith(triggeredBy);
assert(origDisposable.isDisposed()).to.beFalse();
});
示例6: beforeEach
beforeEach(() => {
mockRadioButtonService = jasmine.createSpyObj('RadioButtonService', ['setSelected']);
button = new RadioButton(mockRadioButtonService, Mocks.object('ThemeService'));
TestDispose.add(button);
});
示例7: beforeEach
beforeEach(() => {
tab = new VerticalTab(Mocks.object('ThemeService'));
TestDispose.add(tab);
});
示例8: assert
assert(() => {
TestDispose.add(Main.newInstance({}));
}).toNot.throw();
示例9: beforeEach
beforeEach(() => {
mockFileService = jasmine.createSpyObj('FileService', ['addBundle', 'getBundle']);
input = new FileInput(mockFileService, Mocks.object('ThemeService'));
TestDispose.add(input);
});
示例10: beforeEach
beforeEach(() => {
const mockThemeService = jasmine.createSpyObj('ThemeService', ['applyTheme']);
input = new FloatInput(mockThemeService);
TestDispose.add(input);
});