fix(virtual-scroll): remove runOutsideAngular error (#18752)

fixes #18746
This commit is contained in:
Manu MA
2019-07-10 16:21:42 +02:00
committed by Brandy Carney
parent f060db5fe6
commit 8beeff2c52
15 changed files with 38 additions and 26 deletions

View File

@ -128,7 +128,7 @@ export class IonVirtualScroll {
@ContentChild(VirtualFooter) ftrTmp!: VirtualFooter; @ContentChild(VirtualFooter) ftrTmp!: VirtualFooter;
constructor( constructor(
private zone: NgZone, private z: NgZone,
private iterableDiffers: IterableDiffers, private iterableDiffers: IterableDiffers,
elementRef: ElementRef, elementRef: ElementRef,
) { ) {
@ -162,7 +162,7 @@ export class IonVirtualScroll {
} }
private nodeRender(el: HTMLElement | null, cell: Cell, index: number): HTMLElement { private nodeRender(el: HTMLElement | null, cell: Cell, index: number): HTMLElement {
return this.zone.run(() => { return this.z.run(() => {
let node: EmbeddedViewRef<VirtualContext>; let node: EmbeddedViewRef<VirtualContext>;
if (!el) { if (!el) {
node = this.itmTmp.viewContainer.createEmbeddedView( node = this.itmTmp.viewContainer.createEmbeddedView(

View File

@ -10,7 +10,7 @@ exports.config = {
], ],
capabilities: { capabilities: {
browserName: 'chrome', browserName: 'chrome',
chromeOptions: { chromeOptions: {
args: [ "--headless", "--disable-gpu", "--window-size=400,1000", "--start-maximized" ] args: [ "--headless", "--disable-gpu", "--window-size=400,1000", "--start-maximized" ]
} }

View File

@ -4,7 +4,7 @@ import { handleErrorMessages, setProperty, getText, waitTime } from './utils';
describe('form', () => { describe('form', () => {
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
describe('change', () => { describe('change', () => {

View File

@ -8,7 +8,7 @@ describe('inputs', () => {
await waitTime(30); await waitTime(30);
}); });
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
it('should have default value', async () => { it('should have default value', async () => {

View File

@ -8,7 +8,7 @@ describe('modals', () => {
await waitTime(30); await waitTime(30);
}); });
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
it('should open standalone modal and close', async () => { it('should open standalone modal and close', async () => {

View File

@ -4,7 +4,7 @@ import { handleErrorMessages, waitTime, testStack } from './utils';
describe('navigation', () => { describe('navigation', () => {
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
it('should navigate correctly', async () => { it('should navigate correctly', async () => {

View File

@ -4,7 +4,7 @@ import { waitTime, handleErrorMessages, goBack } from './utils';
describe('nested-outlet', () => { describe('nested-outlet', () => {
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
it('should navigate correctly', async () => { it('should navigate correctly', async () => {

View File

@ -4,7 +4,7 @@ import { handleErrorMessages, waitTime } from './utils';
describe('providers', () => { describe('providers', () => {
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
it('should load all providers', async () => { it('should load all providers', async () => {

View File

@ -9,7 +9,7 @@ describe('router-link params and fragments', () => {
const id = 'MyPageID=='; const id = 'MyPageID==';
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
it('should go to a page with properly encoded values', async () => { it('should go to a page with properly encoded values', async () => {
@ -53,7 +53,7 @@ describe('router-link', () => {
await waitTime(30); await waitTime(30);
}); });
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });

View File

@ -8,7 +8,7 @@ describe('slides', () => {
await waitTime(30); await waitTime(30);
}); });
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
it('should change index on slide change', async () => { it('should change index on slide change', async () => {

View File

@ -3,7 +3,7 @@ import { waitTime, testStack, handleErrorMessages } from './utils';
describe('tabs', () => { describe('tabs', () => {
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
describe('entry url - /tabs', () => { describe('entry url - /tabs', () => {
beforeEach(async () => { beforeEach(async () => {

View File

@ -37,19 +37,12 @@ export interface LifeCycleCount {
} }
export function handleErrorMessages() { export function handleErrorMessages() {
browser.manage().logs().get('browser').then(function(browserLog) { return browser.manage().logs().get('browser').then(function (browserLog) {
let severWarnings = false; for (let i = 0; i <= browserLog.length - 1; i++) {
if (browserLog[i].level.name_ === 'SEVERE') {
for (let i; i <= browserLog.length - 1; i++) { fail(browserLog[i].message);
if (browserLog[i].level.name === 'SEVERE') { }
console.log('\n' + browserLog[i].level.name);
console.log('(Possibly exception) \n' + browserLog[i].message);
severWarnings = true;
}
} }
expect(severWarnings).toBe(false);
}); });
} }

View File

@ -8,7 +8,7 @@ describe('view-child', () => {
await waitTime(30); await waitTime(30);
}); });
afterEach(() => { afterEach(() => {
handleErrorMessages(); return handleErrorMessages();
}); });
it('should get a reference to all children', async () => { it('should get a reference to all children', async () => {

View File

@ -0,0 +1,18 @@
import { browser, element, by } from 'protractor';
import { waitTime, handleErrorMessages } from './utils';
describe('virtual-scroll', () => {
afterEach(() => {
return handleErrorMessages();
});
beforeEach(async () => {
await browser.get('/virtual-scroll');
await waitTime(30);
});
it('should open virtual-scroll', () => {
const virtualElements = element.all(by.css('ion-virtual-scroll > *'));
expect(virtualElements.count()).toBeGreaterThan(0);
});
});

View File

@ -8,6 +8,7 @@
"sync": "sh scripts/sync.sh", "sync": "sh scripts/sync.sh",
"build": "ng build --prod --no-progress", "build": "ng build --prod --no-progress",
"test": "ng e2e --prod", "test": "ng e2e --prod",
"test.dev": "npm run sync && ng e2e",
"lint": "ng lint" "lint": "ng lint"
}, },
"private": true, "private": true,