test(elements): only declare helpers if needed (#36114)
Previously, helper modules/components classes were declared even if the tests were not run (because the environment did not support Custom Elements for example). This commit moves the declaration of the helpers inside the `describe()` block, so they are not declared unnecessarily. This is in preparation of adding more helpers that need to access variables declared inside the `describe()` block. PR Close #36114
This commit is contained in:
parent
1380c5642b
commit
ed46d9ebd7
|
@ -110,8 +110,6 @@ if (browserDetection.supportsCustomElements) {
|
|||
expect(strategy.inputs.get('fooFoo')).toBe('foo-foo-value');
|
||||
expect(strategy.inputs.get('barBar')).toBe('barBar-value');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Helpers
|
||||
@Component({
|
||||
|
@ -135,7 +133,7 @@ class TestModule implements DoBootstrap {
|
|||
ngDoBootstrap() {}
|
||||
}
|
||||
|
||||
export class TestStrategy implements NgElementStrategy {
|
||||
class TestStrategy implements NgElementStrategy {
|
||||
connectedElement: HTMLElement|null = null;
|
||||
disconnectCalled = false;
|
||||
inputs = new Map<string, any>();
|
||||
|
@ -159,10 +157,12 @@ export class TestStrategy implements NgElementStrategy {
|
|||
}
|
||||
}
|
||||
|
||||
export class TestStrategyFactory implements NgElementStrategyFactory {
|
||||
class TestStrategyFactory implements NgElementStrategyFactory {
|
||||
testStrategy = new TestStrategy();
|
||||
|
||||
create(): NgElementStrategy {
|
||||
return this.testStrategy;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue