Skip to content

Commit 2bcf7fd

Browse files
committed
feat(cdk/testing): fix misplaced tests
1 parent 7ecbcc1 commit 2bcf7fd

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/cdk/testing/tests/protractor.e2e.spec.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ describe('ProtractorHarnessEnvironment', () => {
5252
expect(await subHarnessHost.text({exclude: 'h2'})).toBe('ProtractorTestBedOther');
5353
expect(await subHarnessHost.text({exclude: 'li'})).toBe('List of test tools');
5454
});
55+
56+
it('should be able to retrieve the ElementFinder from a ProtractorElement', async () => {
57+
const element = ProtractorHarnessEnvironment.getNativeElement(await harness.host());
58+
expect(await element.getTagName()).toBe('test-main');
59+
});
5560
});
5661

5762
describe('shadow DOM interaction', () => {
@@ -73,13 +78,6 @@ describe('ProtractorHarnessEnvironment', () => {
7378
.getHarness(MainComponentHarness);
7479
expect(await (await harness.deepShadow()).text()).toBe('Shadow 2');
7580
});
76-
77-
it('should be able to retrieve the ElementFinder from a ProtractorElement', async () => {
78-
const harness = await ProtractorHarnessEnvironment.loader({queryFn: piercingQueryFn})
79-
.getHarness(MainComponentHarness);
80-
const element = ProtractorHarnessEnvironment.getNativeElement(await harness.host());
81-
expect(await element.getTagName()).toBe('test-main');
82-
});
8381
});
8482
});
8583

src/cdk/testing/tests/testbed.spec.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ describe('TestbedHarnessEnvironment', () => {
7878
fakeAsync(async () => {
7979
expect(await harness.getTaskStateResult()).toBe('result');
8080
}));
81+
82+
it('should be able to retrieve the native DOM element from a UnitTestElement', async () => {
83+
const element = TestbedHarnessEnvironment.getNativeElement(await harness.host());
84+
expect(element.id).toContain('root');
85+
});
8186
});
8287

8388
describe('change detection behavior', () => {
@@ -150,13 +155,6 @@ describe('TestbedHarnessEnvironment', () => {
150155
);
151156
expect(await (await harness.deepShadow()).text()).toBe('Shadow 2');
152157
});
153-
154-
it('should be able to retrieve the native DOM element from a UnitTestElement', async () => {
155-
const harness = await TestbedHarnessEnvironment
156-
.harnessForFixture(fixture, MainComponentHarness);
157-
const element = TestbedHarnessEnvironment.getNativeElement(await harness.host());
158-
expect(element.id).toContain('root');
159-
});
160158
});
161159
}
162160
});

0 commit comments

Comments
 (0)