2016-12-27 18:23:49 -05:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
2017-03-20 18:04:20 -04:00
|
|
|
import {Component, Directive, Input} from '@angular/core';
|
2016-12-27 18:23:49 -05:00
|
|
|
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
|
|
|
|
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
2017-03-02 15:12:46 -05:00
|
|
|
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
2016-12-27 18:23:49 -05:00
|
|
|
|
|
|
|
export function main() {
|
|
|
|
describe('integration tests', () => {
|
|
|
|
let fixture: ComponentFixture<TestComponent>;
|
|
|
|
|
|
|
|
|
2017-03-24 12:59:58 -04:00
|
|
|
describe('directiv es', () => {
|
2016-12-27 18:23:49 -05:00
|
|
|
it('should support dotted selectors', async(() => {
|
|
|
|
@Directive({selector: '[dot.name]'})
|
|
|
|
class MyDir {
|
|
|
|
@Input('dot.name') value: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
TestBed.configureTestingModule({
|
|
|
|
declarations: [
|
|
|
|
MyDir,
|
|
|
|
TestComponent,
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
const template = `<div [dot.name]="'foo'"></div>`;
|
|
|
|
fixture = createTestComponent(template);
|
|
|
|
fixture.detectChanges();
|
|
|
|
const myDir = fixture.debugElement.query(By.directive(MyDir)).injector.get(MyDir);
|
|
|
|
expect(myDir.value).toEqual('foo');
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Component({selector: 'test-cmp', template: ''})
|
|
|
|
class TestComponent {
|
|
|
|
}
|
|
|
|
|
|
|
|
function createTestComponent(template: string): ComponentFixture<TestComponent> {
|
|
|
|
return TestBed.overrideComponent(TestComponent, {set: {template: template}})
|
|
|
|
.createComponent(TestComponent);
|
|
|
|
}
|