Skip to content

Commit

Permalink
Tests: Adds test to data-nimg data attribute based on layout prop. (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
andersonleite committed Aug 24, 2021
1 parent 5796577 commit 4d5eaf0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/integration/image-component/basic/test/index.test.js
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 4d5eaf0

Please sign in to comment.