本文整理汇总了TypeScript中aurelia-pal.DOM类的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM类的具体用法?TypeScript DOM怎么用?TypeScript DOM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DOM类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: beforeCompile
beforeCompile(content: DocumentFragment, resources: ViewResources, instruction: ViewCompileInstruction): void {
if (instruction.targetShadowDOM) {
DOM.injectStyles(this.css, content as any, true);
} else if (FEATURE.scopedCSS) {
let styleNode = DOM.injectStyles(this.css, content as any, true) as Element;
styleNode.setAttribute('scoped', 'scoped');
} else if (this._global && !this.owner._alreadyGloballyInjected) {
DOM.injectStyles(this.css);
this.owner._alreadyGloballyInjected = true;
}
}
示例2: beforeEach
beforeEach(() => {
container = new Container();
container.registerInstance(Element, DOM.createElement("div"));
templatingEngine = container.get(TemplatingEngine);
sut = templatingEngine.createViewModelForUnitTest(ScrollSpyElement);
});
示例3: exerciseBehavior
function exerciseBehavior(callback) {
let sourceCalls = 0;
let source = {
handleClick: e => {
// console.info('source called');
sourceCalls++;
}
};
let scope = createScopeForTest(source);
// overrides updateSource
binding.bind(scope);
expect(binding.callSource === originalCallSource).not.toBe(true);
for (let i = 0, ii = 50; i < ii; i++) {
button.dispatchEvent(DOM.createCustomEvent('click', { bubbles: true }));
}
// How to ensure this happen after all events without timeout?
let testDuration = 500;
function endTest() {
binding.unbind();
expect(sourceCalls).toEqual(0);
expect(binding.callSource === originalCallSource).toBe(true);
callback();
}
setTimeout(endTest, testDuration);
}
示例4: beforeEach
beforeEach(() => {
container = new Container();
templatingEngine = container.get(TemplatingEngine);
sut = templatingEngine.createViewModelForUnitTest(ButtonElement);
sut.element = DOM.createElement("a");
});
示例5: beforeEach
beforeEach(() => {
container = new Container();
container.registerInstance(Element, DOM.createElement("div"));
templatingEngine = container.get(TemplatingEngine);
sut = templatingEngine.createViewModelForUnitTest(DropdownDividerAttribute);
});
开发者ID:eriklieben,项目名称:old-aurelia-materialize-css-before-rc1,代码行数:7,代码来源:dropdownDividerAttribute.spec.ts
示例6: closeOnEscSpec
async function closeOnEscSpec(done: DoneFn, settings: DialogSettings) {
const renderer = createRenderer(settings);
await show(done, renderer);
DOM.dispatchEvent(new KeyboardEvent('keyup', { key: 'Enter' }));
expect(renderer.__controller.ok).toHaveBeenCalled();
done();
}
示例7: it
it('should set focus value to true when element gets focus', () => {
focus.attached();
setBindedFocusValue(false);
element.dispatchEvent(DOM.createCustomEvent('focus'));
expect(focus.value).toBe(true);
});
示例8: fixupCSSUrls
.then(text => {
text = fixupCSSUrls(this.address, text);
this._scoped.css = text;
if (this._global) {
this._alreadyGloballyInjected = true;
DOM.injectStyles(text);
}
});