當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript aurelia-pal.DOM類代碼示例

本文整理匯總了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;
   }
 }
開發者ID:aurelia,項目名稱:templating-resources,代碼行數:11,代碼來源:css-resource.ts

示例2: beforeEach

    beforeEach(() => {
        container = new Container();
        container.registerInstance(Element, DOM.createElement("div"));
        templatingEngine = container.get(TemplatingEngine);

        sut = templatingEngine.createViewModelForUnitTest(ScrollSpyElement);
    });
開發者ID:eriklieben,項目名稱:old-aurelia-materialize-css-before-rc1,代碼行數:7,代碼來源:scrollspyElement.spec.ts

示例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);
    }
開發者ID:aurelia,項目名稱:templating-resources,代碼行數:28,代碼來源:self-binding-behavior.spec.ts

示例4: beforeEach

    beforeEach(() => {
        container = new Container();
        templatingEngine = container.get(TemplatingEngine);

        sut = templatingEngine.createViewModelForUnitTest(ButtonElement);
        sut.element = DOM.createElement("a");
    });
開發者ID:eriklieben,項目名稱:old-aurelia-materialize-css-before-rc1,代碼行數:7,代碼來源:buttonElement.spec.ts

示例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();
 }
開發者ID:HIRANO-Satoshi,項目名稱:dialog,代碼行數:7,代碼來源:dialog-renderer.spec.ts

示例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);
  });
開發者ID:aurelia,項目名稱:templating-resources,代碼行數:8,代碼來源:focus.spec.ts

示例8: fixupCSSUrls

 .then(text => {
   text = fixupCSSUrls(this.address, text);
   this._scoped.css = text;
   if (this._global) {
     this._alreadyGloballyInjected = true;
     DOM.injectStyles(text);
   }
 });
開發者ID:aurelia,項目名稱:templating-resources,代碼行數:8,代碼來源:css-resource.ts


注:本文中的aurelia-pal.DOM類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。