Last active
November 13, 2016 20:58
-
-
Save ndemengel/749b3e7b2171a364fcaf860173694521 to your computer and use it in GitHub Desktop.
Example of JS test "interpreting" a JSP (the JSP can be found here: https://gist.github.com/ndemengel/54df1425968d9e8d05d052e71b31e4d9)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tu = require('../tu'); | |
const expect = tu.expect; | |
const withDocument = tu.withDocument; | |
const ratingStarsJspAndScript = { | |
jsp: 'include/editableRatingStars', | |
hopModules: 'Hop/components/editable-rating-stars', | |
attributes: { | |
param: {path: 'someRadioInput'} | |
} | |
}; | |
describe('Editable Rating Stars', () => { | |
it('should add "active" class to all ".star"s before the one that has been clicked', | |
withDocument(ratingStarsJspAndScript, $ => { | |
// when | |
$('.star:eq(3) input').change(); | |
// then | |
expect($('.star').get(0).className).to.match(/\bactive\b/); | |
expect($('.star').get(1).className).to.match(/\bactive\b/); | |
expect($('.star').get(2).className).to.match(/\bactive\b/); | |
expect($('.star').get(3).className).to.match(/\bactive\b/); | |
expect($('.star').get(4).className).to.not.match(/\bactive\b/); | |
})); | |
// more tests... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment