Skip to content

Commit a12994d

Browse files
committed
test: add test for data-placeholder-background
1 parent 7a6c9a1 commit a12994d

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

Diff for: dist/lozad.es.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! lozad.js - v1.15.0 - 2020-07-02
1+
/*! lozad.js - v1.15.0 - 2020-07-24
22
* https://github.com/ApoorvSaxena/lozad.js
33
* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */
44

Diff for: dist/lozad.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! lozad.js - v1.15.0 - 2020-07-02
1+
/*! lozad.js - v1.15.0 - 2020-07-24
22
* https://github.com/ApoorvSaxena/lozad.js
33
* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */
44

Diff for: dist/lozad.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: test/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,17 @@ describe('lozad', () => {
206206
'background-image: url(photo.jpg);'
207207
)
208208
})
209+
// Handle image background placeholder
210+
it('should load the image with data-placeholder-background attribute', () => {
211+
const image = document.querySelectorAll('img')[0]
212+
const bgImageSetAttr = 'red'
213+
image.setAttribute('class', 'lozad')
214+
image.setAttribute('data-placeholder-background', bgImageSetAttr)
215+
const observer = lozad()
216+
observer.observe()
217+
assert.strictEqual('true', image.dataset.loaded)
218+
assert.strictEqual(image.style.cssText, 'background: red;')
219+
})
209220
})
210221

211222
describe('when passing options', () => {

0 commit comments

Comments
 (0)