Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add imageSource option to native JS #140

Merged
merged 4 commits into from
Dec 17, 2023
Merged

Conversation

OleVik
Copy link
Contributor

@OleVik OleVik commented Dec 10, 2023

Following #41, adds imageSource as an option to override the href-attribute for source.

src/js/chocolat.js Outdated Show resolved Hide resolved
src/js/chocolat.js Outdated Show resolved Hide resolved
@nicolas-t
Copy link
Owner

Thanks :)

I prefer the name imageSourceAttribute, can you apply the changes and rebuild ?
Also can you write a test ?
I'll update the documenation

Thanks

OleVik and others added 2 commits December 14, 2023 13:59
Co-authored-by: Nicolas Turlais <nicolas.turlais@gmail.com>
Co-authored-by: Nicolas Turlais <nicolas.turlais@gmail.com>
@OleVik
Copy link
Contributor Author

OleVik commented Dec 14, 2023

The repo isn't quite compatible with Windows, so I can't compile or test without changing a lot. It's been a while since I wrote tests, but I'd think it would be something akin to:

describe('Image source and attributes', function() {
  before(function() {
    chocolat = Chocolat(document.querySelectorAll('#example1 .chocolat-image'), {})
  })
  it('Should use the preferred attribute as a source', function() {})
})

And in index.html add an attribute like alternative="../demo/demo-images/1920x1080.png" to verify against.

@nicolas-t nicolas-t merged commit 66ad202 into nicolas-t:master Dec 17, 2023
@nicolas-t
Copy link
Owner

Thanks, released in v1.1.2
https://www.npmjs.com/package/chocolat?activeTab=versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants