test(core): remove code specific to IE 9 and IE 10 (#39090)

This commit updates core tests and removes the code needed to support IE 9 and IE 10 only.
The code is no longer needed since IE 9 and IE 10 support is removed in v11.

PR Close #39090
This commit is contained in:
Andrew Kushnir 2020-10-01 18:22:32 -07:00 committed by atscott
parent 584f37cfca
commit 78a33eeef9
4 changed files with 4 additions and 26 deletions

View File

@ -2304,18 +2304,6 @@ describe('di', () => {
}); });
it('should not be able to inject ViewRef', () => { it('should not be able to inject ViewRef', () => {
// If the current browser does not support `__proto__` natively, this test will never
// result in an error as the `__NG_ELEMENT_ID__` from `ChangeDetectorRef` is directly
// assigned to the `ViewRef` instance, due to TypeScript, and `setPrototypeOf` polyfills
// not being able to simulate the prototype chain. This means that Angular's DI system
// considers `ViewRef` as injectable due to it having a `__NG_ELEMENT_ID__` directly
// assigned. We skip this test in such cases. This is currently the case in IE9 and
// IE10 as those don't support `__proto__`. Related TypeScript issue:
// https://github.com/microsoft/TypeScript/issues/1601#issuecomment-94892833.
if (!('__proto__' in {})) {
return;
}
@Component({template: ''}) @Component({template: ''})
class App { class App {
constructor(_viewRef: ViewRef) {} constructor(_viewRef: ViewRef) {}

View File

@ -1132,9 +1132,6 @@ describe('host bindings', () => {
fixture.componentInstance.name = 'Ned'; fixture.componentInstance.name = 'Ned';
fixture.detectChanges(); fixture.detectChanges();
// Note that we assert for each binding individually, rather than checking against
// innerHTML, because IE10 changes the attribute order and makes it inconsistent with
// all other browsers.
expect(hostElement.id).toBe('red,blue'); expect(hostElement.id).toBe('red,blue');
expect(hostElement.title).toBe('blue'); expect(hostElement.title).toBe('blue');
expect(fixture.nativeElement.innerHTML.endsWith('Ned')).toBe(true); expect(fixture.nativeElement.innerHTML.endsWith('Ned')).toBe(true);

View File

@ -3460,8 +3460,8 @@ describe('styling', () => {
if (!ivyEnabled && !supportsWritingStringsToStyleProperty()) { if (!ivyEnabled && !supportsWritingStringsToStyleProperty()) {
// VE does not treat `[style]` as anything special, instead it simply writes to the // VE does not treat `[style]` as anything special, instead it simply writes to the
// `style` property on the element like so `element.style=value`. This seems to work fine // `style` property on the element like so `element.style=value`. This seems to work fine
// every where except ie10, where it throws an error and as a consequence this test fails in // every where except IE11, where it throws an error and as a consequence this test fails in
// VE on ie10. // VE on IE11.
return; return;
} }
@Component({template: `<div [style]="style"></div>`}) @Component({template: `<div [style]="style"></div>`})
@ -3479,7 +3479,7 @@ describe('styling', () => {
/** /**
* Tests to see if the current browser supports non standard way of writing into styles. * Tests to see if the current browser supports non standard way of writing into styles.
* *
* This is not the correct way to write to style and is not supported in ie10. * This is not the correct way to write to style and is not supported in IE11.
* ``` * ```
* div.style = 'color: white'; * div.style = 'color: white';
* ``` * ```
@ -3490,7 +3490,7 @@ describe('styling', () => {
* ``` * ```
* *
* Even though writing to `div.style` is not officially supported, it works in all * Even though writing to `div.style` is not officially supported, it works in all
* browsers except ie10. * browsers except IE11.
* *
* This function detects this condition and allows us to skip the test. * This function detects this condition and allows us to skip the test.
*/ */

View File

@ -1290,13 +1290,6 @@ describe('providers', () => {
function addFoo() { function addFoo() {
return (constructor: Type<any>): any => { return (constructor: Type<any>): any => {
const decoratedClass = class Extender extends constructor { foo = 'bar'; }; const decoratedClass = class Extender extends constructor { foo = 'bar'; };
// On IE10 child classes don't inherit static properties by default. If we detect
// such a case, try to account for it so the tests are consistent between browsers.
if (Object.getPrototypeOf(decoratedClass) !== constructor) {
decoratedClass.prototype = constructor.prototype;
}
return decoratedClass; return decoratedClass;
}; };
} }