Skip to content

Commit

Permalink
added test case for malformed json in data attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Mar 3, 2015
1 parent 4c0a107 commit 7905c8b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/api/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ describe('$(...)', function() {
expect($el.data('test')).to.be('a');
});

it('(key) : should recover from malformed JSON', function() {
var $el = cheerio('<div data-custom="{{templatevar}}">');

expect($el.data('custom')).to.be('{{templatevar}}');
});

it('(hyphen key) : data addribute with hyphen should be camelized ;-)', function() {
var data = $('.frey').data();
expect(data).to.eql({
Expand Down

0 comments on commit 7905c8b

Please sign in to comment.