Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test: add test for data-placeholder-background
  • Loading branch information
igorkamyshev committed Jul 24, 2020
1 parent 7a6c9a1 commit a12994d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/lozad.es.js
@@ -1,4 +1,4 @@
/*! lozad.js - v1.15.0 - 2020-07-02
/*! lozad.js - v1.15.0 - 2020-07-24
* https://github.com/ApoorvSaxena/lozad.js
* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */

Expand Down
2 changes: 1 addition & 1 deletion dist/lozad.js
@@ -1,4 +1,4 @@
/*! lozad.js - v1.15.0 - 2020-07-02
/*! lozad.js - v1.15.0 - 2020-07-24
* https://github.com/ApoorvSaxena/lozad.js
* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */

Expand Down
2 changes: 1 addition & 1 deletion dist/lozad.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions test/index.js
Expand Up @@ -206,6 +206,17 @@ describe('lozad', () => {
'background-image: url(photo.jpg);'
)
})
// Handle image background placeholder
it('should load the image with data-placeholder-background attribute', () => {
const image = document.querySelectorAll('img')[0]
const bgImageSetAttr = 'red'
image.setAttribute('class', 'lozad')
image.setAttribute('data-placeholder-background', bgImageSetAttr)
const observer = lozad()
observer.observe()
assert.strictEqual('true', image.dataset.loaded)
assert.strictEqual(image.style.cssText, 'background: red;')
})
})

describe('when passing options', () => {
Expand Down

0 comments on commit a12994d

Please sign in to comment.