Pull in jQuery and chai-jquery

This commit is contained in:
Alexander Surma 2015-03-18 12:53:26 +00:00
parent 7b8b2f0a0d
commit 08f1a871eb
3 changed files with 14 additions and 11 deletions

View File

@ -16,6 +16,7 @@
"apache-server-configs": "^2.7.1",
"browser-sync": "^2.0.1",
"chai": "^2.0.0",
"chai-jquery": "^2.0.0",
"del": "^1.1.1",
"gulp": "^3.8.5",
"gulp-autoprefixer": "^2.0.0",
@ -37,6 +38,7 @@
"gulp-sourcemaps": "^1.3.0",
"gulp-uglify": "^1.0.1",
"gulp-useref": "^1.0.1",
"jquery": "^2.1.3",
"jshint-stylish": "^1.0.0",
"mocha": "^2.1.0",
"opn": "^1.0.0",

View File

@ -10,8 +10,10 @@
</head>
<body>
<div id="mocha"></div>
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>
<script src="../node_modules/chai-jquery/chai-jquery.js"></script>
<!-- <script src="../js/material.js"></script> -->
<!-- The following components rely on the requestAnimFrame shim (incomplete list): -->
<!-- menu -->

View File

@ -11,8 +11,7 @@
parent.appendChild(el)
componentHandler.upgradeElement(el, 'MaterialMenu');
var upgraded = el.getAttribute('data-upgraded');
expect(upgraded).to.contain('MaterialMenu');
expect($(el)).to.have.data('upgraded', ',MaterialMenu');
});
describe ('visibility API', function () {
@ -22,10 +21,10 @@
componentHandler.upgradeElement(el, 'MaterialMenu');
it('should start the showing animation on show()', function(done) {
expect(el.widget.container_.className).to.not.contain('is-visible');
expect($(el.widget.container_)).to.not.have.class('is-visible');
el.widget.show();
window.setTimeout(function() {
expect(el.widget.container_.className).to.contain('is-visible');
expect($(el.widget.container_)).to.have.class('is-visible');
var ev = document.createEvent('HTMLEvents');
ev.initEvent('transitionend', true, true)
@ -35,10 +34,10 @@
});
it('should start the hiding animation on hide()', function(done) {
expect(el.widget.container_.className).to.contain('is-visible');
expect($(el.widget.container_)).to.have.class('is-visible');
el.widget.hide();
window.setTimeout(function() {
expect(el.widget.container_.className).to.not.contain('is-visible');
expect($(el.widget.container_)).to.not.have.class('is-visible');
var ev = document.createEvent('HTMLEvents');
ev.initEvent('transitionend', true, true)
@ -48,10 +47,10 @@
});
it('should start the showing animating on toggle() when invisible', function(done) {
expect(el.widget.container_.className).to.not.contain('is-visible');
expect($(el.widget.container_)).to.not.have.class('is-visible');
el.widget.toggle();
window.setTimeout(function() {
expect(el.widget.container_.className).to.contain('is-visible');
expect($(el.widget.container_)).to.have.class('is-visible');
var ev = document.createEvent('HTMLEvents');
ev.initEvent('transitionend', true, true)
@ -61,10 +60,10 @@
});
it('should start the hiding animating on toggle() when visible', function(done) {
expect(el.widget.container_.className).to.contain('is-visible');
expect($(el.widget.container_)).to.have.class('is-visible');
el.widget.toggle();
window.setTimeout(function() {
expect(el.widget.container_.className).to.not.contain('is-visible');
expect($(el.widget.container_)).to.not.have.class('is-visible');
var ev = document.createEvent('HTMLEvents');
ev.initEvent('transitionend', true, true)
@ -94,7 +93,7 @@
ev.initEvent('click', true, true);
button.dispatchEvent(ev);
window.setTimeout(function() {
expect(el.widget.container_.className).to.contain('is-visible');
expect($(el.widget.container_)).to.have.class('is-visible');
document.body.removeChild(ctr);
done();
}, 100);