From 4d5eaf0efb5712e5504610d83626b15f5141a492 Mon Sep 17 00:00:00 2001 From: Anderson Leite Date: Tue, 24 Aug 2021 13:36:49 -0700 Subject: [PATCH] Tests: Adds test to data-nimg data attribute based on layout prop. (#28444) Adds tests to the Image component to verify that the correct data is being exposed. Based on #27899 and #28312 ## Bug - [ ] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes --- test/integration/image-component/basic/test/index.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/integration/image-component/basic/test/index.test.js b/test/integration/image-component/basic/test/index.test.js index b350812b9502880..e7163430c7368ef 100644 --- a/test/integration/image-component/basic/test/index.test.js +++ b/test/integration/image-component/basic/test/index.test.js @@ -308,6 +308,14 @@ describe('Image Component Tests', () => { it('should not create any preload tags higher up the page than CSS preload tags', async () => { expect(await hasImagePreloadBeforeCSSPreload()).toBe(false) }) + it('should add data-nimg data attribute based on layout', async () => { + expect( + await browser.elementById('image-with-sizes').getAttribute('data-nimg') + ).toBe('responsive') + expect( + await browser.elementById('basic-image').getAttribute('data-nimg') + ).toBe('intrinsic') + }) }) describe('Client-side Image Component Tests', () => { beforeAll(async () => {