本文整理匯總了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);
}
});