当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript DOM.hasClass方法代码示例

本文整理汇总了TypeScript中angular2/src/dom/dom_adapter.DOM.hasClass方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.hasClass方法的具体用法?TypeScript DOM.hasClass怎么用?TypeScript DOM.hasClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/src/dom/dom_adapter.DOM的用法示例。


在下文中一共展示了DOM.hasClass方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

      it('should de-normalize class names', () => {
        view.setElementClass(0, 'veryActive', true);
        expect(DOM.hasClass(el, 'very-active')).toEqual(true);

        view.setElementClass(0, 'veryActive', false);
        expect(DOM.hasClass(el, 'very-active')).toEqual(false);
      });
开发者ID:cedriclam,项目名称:angular,代码行数:7,代码来源:view_spec.ts

示例2: it

    it('should add CSS classes if "class" specified in host element attributes', () => {
      var element = el('<input class="foo baz" some-decor-with-host-attrs>');
      var results = process(element);

      expect(DOM.hasClass(results[0].element, 'foo')).toBeTruthy();
      expect(DOM.hasClass(results[0].element, 'bar')).toBeTruthy();
      expect(DOM.hasClass(results[0].element, 'baz')).toBeTruthy();
    });
开发者ID:lavinjj,项目名称:angular,代码行数:8,代码来源:directive_parser_spec.ts

示例3: it

 it('should return a setter for a class', () => {
   var setterFn = setterFactory('class.active');
   setterFn(div, true);
   expect(DOM.hasClass(div, 'active')).toEqual(true);
   setterFn(div, false);
   expect(DOM.hasClass(div, 'active')).toEqual(false);
   var otherSetterFn = setterFactory('class.active');
   expect(setterFn).toBe(otherSetterFn);
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:9,代码来源:property_setter_factory_spec.ts

示例4: it

      it('should de-normalize class names', () => {
        var setterFn = setterFactory.createSetter(div, false, 'class.veryActive');
        setterFn(div, true);
        expect(DOM.hasClass(div, 'very-active')).toEqual(true);
        setterFn(div, false);
        expect(DOM.hasClass(div, 'very-active')).toEqual(false);

        var otherSetterFn = setterFactory.createSetter(div, false, 'class.veryActive');
        expect(setterFn).toBe(otherSetterFn);
      });
开发者ID:AsherBarak,项目名称:angular,代码行数:10,代码来源:property_setter_factory_spec.ts

示例5: expect

             .then((rootTestComponent) => {
               rootTestComponent.detectChanges();

               var childTestEls = rootTestComponent.queryAll(By.directive(MessageDir), Scope.view);

               expect(childTestEls.length).toBe(2);
               expect(DOM.hasClass(childTestEls[0].domElement, 'parent')).toBe(true);
               expect(DOM.hasClass(childTestEls[1].domElement, 'parentnested')).toBe(true);

               async.done();
             });
开发者ID:B-Thapa,项目名称:angular,代码行数:11,代码来源:debug_element_spec.ts

示例6: _dfsAndCreateNativeElements

	_dfsAndCreateNativeElements(childrenParam, boundElements) {
		var resultingNativeChildren = [];
		for (var i = 0; i < childrenParam.length; i++) {
			var node = childrenParam[i];
			var nativeElement;
			if (node.type == "tag") {
				nativeElement = new ReactNativeElement(node.name, node.attribs);
			} else if (node.type == "text") {
				nativeElement = new ReactNativeElement("rawtext", {text:node.data});
			}

			if (DOM.hasClass(node, NG_BINDING_CLASS)) {
				boundElements.push(nativeElement);
			}

			//create and then attach children
			if (node.children && node.name != "template") {
				var children = this._dfsAndCreateNativeElements(node.children, boundElements);
				for (var j = 0; j < children.length; j++) {
					var child = children[j];
					nativeElement.insertChildAtIndex(child, j);
				}
			}
			resultingNativeChildren.push(nativeElement)
		}
		return resultingNativeChildren;
	}
开发者ID:gitter-badger,项目名称:react-native-renderer,代码行数:27,代码来源:renderer.ts

示例7: expect

 tb.createView(TestComponent, {html: html}).then((view) => {
   view.detectChanges();
   DOM.addClass(view.nodes[0].childNodes[1], "foo");
   view.context.numberCondition = 2;
   view.detectChanges();
   expect(DOM.hasClass(view.nodes[0].childNodes[1], "foo")).toBe(true);
   async.done();
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:8,代码来源:if_spec.ts

示例8: constructor

 constructor({elementBinders,
   element,
   isRootView}) {
   this.element = element;
   this.elementBinders = elementBinders;
   this.isTemplateElement = DOM.isTemplateElement(this.element);
   this.isRootView = isRootView;
   this.rootBindingOffset = (isPresent(this.element) && DOM.hasClass(this.element, NG_BINDING_CLASS)) ? 1 : 0;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:9,代码来源:proto_view.ts


注:本文中的angular2/src/dom/dom_adapter.DOM.hasClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。