Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavjha committed May 21, 2015
1 parent 88254cb commit fb317be
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/amd-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
define([
'chai',
'chaiA11y'
], function (chai, chaiA11y) {
'chaiA11y',
'jquery'
], function (chai, chaiA11y, $) {
'use strict';
chai.use(chaiA11y);
var expect = chai.expect;
Expand Down Expand Up @@ -29,5 +30,18 @@ define([
]
});
});
it('should not pollute the DOM', function () {
return expect('<button id="temp_id">temp</button>').to.be.accessible().then(function () {
return expect($('#temp_id').size()).to.eql(0);
});
});
it('should not move or delete an existing element', function () {
var btn = $('<button id="temp_id">temp</button>');
$('body').append($('<div id="temp_div"></div>').append(btn));
return expect(btn).to.be.accessible().then(function () {
expect($('#temp_div > #temp_id').size()).to.eql(1);
$('#temp_id').remove();
});
})
});
});
14 changes: 14 additions & 0 deletions test/commonjs-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';
var chai = require('chai');
var $ = require('jquery');
chai.use(require('../lib'));
var expect = chai.expect;
describe('chai a11y', function () {
Expand All @@ -26,4 +27,17 @@ describe('chai a11y', function () {
]
});
});
it('should not pollute the DOM', function () {
return expect('<button id="temp_id">temp</button>').to.be.accessible().then(function () {
return expect($('#temp_id').size()).to.eql(0);
});
});
it('should not move or delete an existing element', function () {
var btn = $('<button id="temp_id">temp</button>');
$('body').append($('<div id="temp_div"></div>').append(btn));
return expect(btn).to.be.accessible().then(function () {
expect($('#temp_div > #temp_id').size()).to.eql(1);
$('#temp_id').remove();
});
})
});
13 changes: 13 additions & 0 deletions test/script-tag-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,17 @@ describe('chai a11y', function () {
]
});
});
it('should not pollute the DOM', function () {
return expect('<button id="temp_id">temp</button>').to.be.accessible().then(function () {
return expect($('#temp_id').size()).to.eql(0);
});
});
it('should not move or delete an existing element', function () {
var btn = $('<button id="temp_id">temp</button>');
$('body').append($('<div id="temp_div"></div>').append(btn));
return expect(btn).to.be.accessible().then(function () {
expect($('#temp_div > #temp_id').size()).to.eql(1);
$('#temp_id').remove();
});
})
});

0 comments on commit fb317be

Please sign in to comment.