本文整理匯總了TypeScript中@angular/core.DebugElement.query方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript DebugElement.query方法的具體用法?TypeScript DebugElement.query怎麽用?TypeScript DebugElement.query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/core.DebugElement
的用法示例。
在下文中一共展示了DebugElement.query方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should have copy button', () => {
const button: DebugElement = de.query(By.css('dot-copy-button '));
expect(button.componentInstance.copy).toBe('http://demo.dotcms.com:9876/an/url/test');
expect(button.componentInstance.tooltipText).toBe('Copy url page');
});
示例2: it
it('shoudl set fixed width to dropdown', () => {
fixture.detectChanges();
const pDropDown: Dropdown = de.query(By.css('p-dropdown')).componentInstance;
expect(pDropDown.style).toEqual({ width: '100px' });
});
示例3: it
it('should have font awesome icon', () => {
comp.icon = 'fa-test';
fixture.detectChanges();
const faIcon: HTMLElement = de.query(By.css('.fa')).componentInstance;
expect(faIcon).toBeDefined();
});
示例4: it
it('should have correct attributes on button', () => {
const iconButton: DotIconButtonComponent = de.query(By.css('dot-icon-button'))
.componentInstance;
expect(iconButton.icon).toEqual('help_outline');
});
示例5: openSelectBox
function openSelectBox() {
const selectBox = debug.query(By.css(('[data-automation-id="site-my-files-option"] .mat-select-trigger')));
selectBox.triggerEventHandler('click', null);
}
示例6:
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';
let debugElement: DebugElement;
class MyDirective {}
// #docregion by_all
debugElement.query(By.all());
// #enddocregion
// #docregion by_css
debugElement.query(By.css('[attribute]'));
// #enddocregion
// #docregion by_directive
debugElement.query(By.directive(MyDirective));
// #enddocregion
示例7: it
it("hides the list", () => {
let el = element.query(By.css(".hab-build-list ol"));
expect(el).toBeNull();
});
示例8: testDialogIsOpen
function testDialogIsOpen(debugElement: DebugElement, dialog: IgxDialogComponent, isOpen: boolean) {
const dialogDebugElement = debugElement.query(By.css(".igx-dialog"));
expect(dialog.isOpen).toEqual(isOpen);
}
示例9: it
it('should show messages', () => {
component.message = 'Authentication failed. Please try again.';
fixture.detectChanges();
const messageElemement = de.query(By.css('.error-message'));
expect(messageElemement).not.toBeNull();
});
示例10: getEmbeddedPlunkerComponent
function getEmbeddedPlunkerComponent() {
const compDe = liveExampleDe.query(By.directive(EmbeddedPlunkerComponent));
return compDe && compDe.componentInstance as EmbeddedPlunkerComponent;
}