From 26164bc7320e4c5ac58c9e4aba52cc995a7d87cd Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Tue, 23 Mar 2021 00:46:37 +0800 Subject: [PATCH 1/2] remove visibility-hidden --- packages/next/client/image.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/next/client/image.tsx b/packages/next/client/image.tsx index 108d83258590..7ea3f794bcfa 100644 --- a/packages/next/client/image.tsx +++ b/packages/next/client/image.tsx @@ -295,8 +295,6 @@ export default function Image({ let sizerStyle: JSX.IntrinsicElements['div']['style'] | undefined let sizerSvg: string | undefined let imgStyle: ImgElementStyle | undefined = { - visibility: isVisible ? 'inherit' : 'hidden', - position: 'absolute', top: 0, left: 0, From 276b285bc58ecddc0f8b526aef845fa269152df8 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Tue, 23 Mar 2021 01:16:19 +0800 Subject: [PATCH 2/2] remove visibility tests --- .../base-path/test/index.test.js | 55 ------------------- .../default/test/index.test.js | 55 ------------------- 2 files changed, 110 deletions(-) diff --git a/test/integration/image-component/base-path/test/index.test.js b/test/integration/image-component/base-path/test/index.test.js index e5c98edf13f2..bda5a9e8f27e 100644 --- a/test/integration/image-component/base-path/test/index.test.js +++ b/test/integration/image-component/base-path/test/index.test.js @@ -51,23 +51,6 @@ async function getComputed(browser, id, prop) { return null } -async function getComputedStyle(browser, id, prop) { - const val = await browser.eval( - `window.getComputedStyle(document.getElementById('${id}')).${prop}` - ) - if (typeof val === 'number') { - return val - } - if (typeof val === 'string') { - const v = parseInt(val, 10) - if (isNaN(v)) { - return val - } - return v - } - return null -} - async function getSrc(browser, id) { const src = await browser.elementById(id).getAttribute('src') if (src) { @@ -442,44 +425,6 @@ function runTests(mode) { }) } - it('should correctly inherit the visibilty of the parent component', async () => { - let browser - try { - browser = await webdriver(appPort, '/docs/hidden-parent') - - const id = 'hidden-image' - - // Wait for image to load: - await check(async () => { - const result = await browser.eval( - `document.getElementById(${JSON.stringify(id)}).naturalWidth` - ) - - if (result < 1) { - throw new Error('Image not ready') - } - - return 'result-correct' - }, /result-correct/) - - await waitFor(1000) - - const desiredVisibilty = await getComputed( - browser, - id, - 'style.visibility' - ) - expect(desiredVisibilty).toBe('inherit') - - const actualVisibility = await getComputedStyle(browser, id, 'visibility') - expect(actualVisibility).toBe('hidden') - } finally { - if (browser) { - await browser.close() - } - } - }) - it('should correctly ignore prose styles', async () => { let browser try { diff --git a/test/integration/image-component/default/test/index.test.js b/test/integration/image-component/default/test/index.test.js index 4d8f90329ba7..fa96399819ea 100644 --- a/test/integration/image-component/default/test/index.test.js +++ b/test/integration/image-component/default/test/index.test.js @@ -53,23 +53,6 @@ async function getComputed(browser, id, prop) { return null } -async function getComputedStyle(browser, id, prop) { - const val = await browser.eval( - `window.getComputedStyle(document.getElementById('${id}')).${prop}` - ) - if (typeof val === 'number') { - return val - } - if (typeof val === 'string') { - const v = parseInt(val, 10) - if (isNaN(v)) { - return val - } - return v - } - return null -} - async function getSrc(browser, id) { const src = await browser.elementById(id).getAttribute('src') if (src) { @@ -505,44 +488,6 @@ function runTests(mode) { }) } - it('should correctly inherit the visibilty of the parent component', async () => { - let browser - try { - browser = await webdriver(appPort, '/hidden-parent') - - const id = 'hidden-image' - - // Wait for image to load: - await check(async () => { - const result = await browser.eval( - `document.getElementById(${JSON.stringify(id)}).naturalWidth` - ) - - if (result < 1) { - throw new Error('Image not ready') - } - - return 'result-correct' - }, /result-correct/) - - await waitFor(1000) - - const desiredVisibilty = await getComputed( - browser, - id, - 'style.visibility' - ) - expect(desiredVisibilty).toBe('inherit') - - const actualVisibility = await getComputedStyle(browser, id, 'visibility') - expect(actualVisibility).toBe('hidden') - } finally { - if (browser) { - await browser.close() - } - } - }) - it('should correctly ignore prose styles', async () => { let browser try {