New tests, better naming
This commit is contained in:
parent
8998237211
commit
b63d42b8d7
|
@ -13,7 +13,10 @@ module.exports = function(grunt) {
|
||||||
},
|
},
|
||||||
dalek: {
|
dalek: {
|
||||||
test: {
|
test: {
|
||||||
src: 'tests/keys.js'
|
src: [
|
||||||
|
'tests/shortcuts.js',
|
||||||
|
'tests/inner-nav.js'
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -21,6 +24,6 @@ module.exports = function(grunt) {
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
grunt.loadNpmTasks('grunt-dalek');
|
grunt.loadNpmTasks('grunt-dalek');
|
||||||
|
|
||||||
grunt.registerTask('default', ['uglify', 'dalek']);
|
grunt.registerTask('default', ['uglify']);
|
||||||
|
|
||||||
};
|
};
|
|
@ -0,0 +1,10 @@
|
||||||
|
module.exports = {
|
||||||
|
// Right
|
||||||
|
'Right Arrow key is switching .next to .active': function (test) {
|
||||||
|
test
|
||||||
|
.open('themes/ribbon/index.html?full#20')
|
||||||
|
.sendKeys('body', '\uE014') // Right
|
||||||
|
.assert.attr('[id="20"] li:nth-child(2)', 'class', 'next active', 'First .next is .active')
|
||||||
|
.done();
|
||||||
|
}
|
||||||
|
};
|
|
@ -3,16 +3,18 @@ module.exports = {
|
||||||
test
|
test
|
||||||
.open('themes/ribbon/index.html')
|
.open('themes/ribbon/index.html')
|
||||||
.sendKeys('body', '\uE035') // F5
|
.sendKeys('body', '\uE035') // F5
|
||||||
.assert.attr('body', 'class', 'full')
|
.assert.attr('body', 'class', 'full', 'Mode is full')
|
||||||
.done();
|
.done();
|
||||||
},
|
},
|
||||||
|
// F5
|
||||||
'Body class is switching from `full` to `list` on F5': function (test) {
|
'Body class is switching from `full` to `list` on F5': function (test) {
|
||||||
test
|
test
|
||||||
.open('themes/ribbon/index.html?full')
|
.open('themes/ribbon/index.html?full')
|
||||||
.sendKeys('body', '\uE035') // F5
|
.sendKeys('body', '\uE035') // F5
|
||||||
.assert.attr('body', 'class', 'list')
|
.assert.attr('body', 'class', 'list', 'Mode is list')
|
||||||
.done();
|
.done();
|
||||||
},
|
},
|
||||||
|
// Cmd Alt P — how to test multiple keys?
|
||||||
// 'Body class is switching from `list` to `full` on Cmd Alt P': function (test) {
|
// 'Body class is switching from `list` to `full` on Cmd Alt P': function (test) {
|
||||||
// test
|
// test
|
||||||
// .open('themes/ribbon/index.html')
|
// .open('themes/ribbon/index.html')
|
||||||
|
@ -20,32 +22,45 @@ module.exports = {
|
||||||
// .assert.attr('body', 'class', 'full')
|
// .assert.attr('body', 'class', 'full')
|
||||||
// .done();
|
// .done();
|
||||||
// },
|
// },
|
||||||
|
// Esc
|
||||||
'Body class is switching from `full` to `list` on Esc': function (test) {
|
'Body class is switching from `full` to `list` on Esc': function (test) {
|
||||||
test
|
test
|
||||||
.open('themes/ribbon/index.html?full')
|
.open('themes/ribbon/index.html?full')
|
||||||
.sendKeys('body', '\uE00C') // Esc
|
.sendKeys('body', '\uE00C') // Esc
|
||||||
.assert.attr('body', 'class', 'list')
|
.assert.attr('body', 'class', 'list', 'Mode is list')
|
||||||
.done();
|
.done();
|
||||||
},
|
},
|
||||||
'End key works as expected': function (test) {
|
// End
|
||||||
|
'End key select the last slide': function (test) {
|
||||||
test
|
test
|
||||||
.open('themes/ribbon/index.html')
|
.open('themes/ribbon/index.html')
|
||||||
.sendKeys('body', '\uE010') // End
|
.sendKeys('body', '\uE010') // End
|
||||||
.assert.attr('.slide:last-of-type', 'class', 'slide active')
|
.assert.attr('.slide:last-of-type', 'class', 'slide active', 'Last slide is active')
|
||||||
.done();
|
.done();
|
||||||
},
|
},
|
||||||
'Home key works as expected': function (test) {
|
// Home
|
||||||
|
'Home key select the first slide': function (test) {
|
||||||
test
|
test
|
||||||
.open('themes/ribbon/index.html#20')
|
.open('themes/ribbon/index.html#20')
|
||||||
.sendKeys('body', '\uE011') // Home
|
.sendKeys('body', '\uE011') // Home
|
||||||
.assert.attr('.slide:first-of-type', 'class', 'slide active')
|
.assert.attr('.slide:first-of-type', 'class', 'slide active', 'First slide is active')
|
||||||
.done();
|
.done();
|
||||||
},
|
},
|
||||||
'Enter is not opening slide if there’s no current': function (test) {
|
// Enter
|
||||||
|
'Enter is opening current slide': function (test) {
|
||||||
|
test
|
||||||
|
.open('themes/ribbon/index.html#1')
|
||||||
|
.sendKeys('body', '\uE007') // Enter
|
||||||
|
.assert.attr('body', 'class', 'full', 'Full mode')
|
||||||
|
.assert.attr('[id="1"]', 'class', 'slide active', 'Slide #1 is active')
|
||||||
|
.done();
|
||||||
|
},
|
||||||
|
// Enter
|
||||||
|
'Enter is not opening any slide if there’s no current': function (test) {
|
||||||
test
|
test
|
||||||
.open('themes/ribbon/index.html')
|
.open('themes/ribbon/index.html')
|
||||||
.sendKeys('body', '\uE007') // Enter
|
.sendKeys('body', '\uE007') // Enter
|
||||||
.assert.attr('body', 'class', 'list')
|
.assert.attr('body', 'class', 'list', 'Mode is list')
|
||||||
.done();
|
.done();
|
||||||
}
|
}
|
||||||
// uE004 Tab
|
// uE004 Tab
|
Loading…
Reference in New Issue