Skip to content

Commit

Permalink
checkbox: Write Gemini tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gela committed Jul 9, 2014
1 parent 0eca183 commit 9d6beda
Show file tree
Hide file tree
Showing 84 changed files with 210 additions and 0 deletions.
144 changes: 144 additions & 0 deletions common.blocks/checkbox/checkbox.tests/gemini.bemjson.js
@@ -0,0 +1,144 @@
({
block : 'page',
title : 'bem-components: checkbox',
mods : { theme : 'normal' },
head : [
{ elem : 'css', url : '_gemini.css' },
{ elem : 'js', url : '_gemini.js' }
],
content : [

{ tag : 'h2', content : 'default' },
{
block : 'test', content : {
block : 'checkbox',
text : 'first'
},
cls : 'default-enabled'
},
{
block : 'test', content : {
block : 'checkbox',
mods : { disabled : true },
text : 'second'
},
cls : 'default-disabled'
},
{
block : 'test', content : {
block : 'checkbox',
mods : { disabled : true, checked : true },
text : 'third'
},
cls : 'default-disabled-checked'
},

{ tag : 'hr' },

{ tag : 'h2', content : 'normal' },
{
block : 'test',
content : {
block : 'checkbox',
mods : { theme : 'normal', size : 'm' },
text : 'size_m'
},
cls : 'normal-size_m-enabled'
},
{
block : 'test',
content : {
block : 'checkbox',
mods : { theme : 'normal', size : 'm', disabled : true },
text : 'size_m'
},
cls : 'normal-size_m-disabled'
},
{
block : 'test',
content : {
block : 'checkbox',
mods : { theme : 'normal', size : 'm', disabled : true, checked : true },
text : 'size_m'
},
cls : 'normal-size_m-disabled-checked'
},
{
block : 'test',
content : {
block : 'checkbox',
mods : { theme : 'normal', size : 'l' },
text : 'size_l'
},
cls : 'normal-size_l-enabled'
},
{
block : 'test',
content : {
block : 'checkbox',
mods : { theme : 'normal', size : 'l', disabled : true },
text : 'size_l'
},
cls : 'normal-size_l-disabled'
},
{
block : 'test',
content : {
block : 'checkbox',
mods : { theme : 'normal', size : 'l', disabled : true, checked : true },
text : 'size_l'
},
cls : 'normal-size_l-disabled-checked'
},

{ tag : 'hr' },

{ tag : 'h2', content : 'normal-button' },
[
{
block : 'checkbox',
mods : { theme : 'normal', size : 'm', type : 'button' },
text : 'first',
mix : [{ block : 'normal-button-enabled' }]
},
{
block : 'checkbox',
mods : { theme : 'normal', size : 'm', type : 'button', disabled : true },
text : 'second',
mix : [{ block : 'normal-button-disabled' }]
},
{
block : 'checkbox',
mods : { theme : 'normal', size : 'm', type : 'button', disabled : true, checked : true },
text : 'third',
mix : [{ block : 'normal-button-disabled-checked' }]
},
{
block : 'checkbox',
mods : { theme : 'normal', size : 'm', type : 'button' },
text : 'icon',
icon : { block : 'icon', mods : { social : 'twitter' } },
mix : [{ block : 'normal-button-icon-enabled' }]
},
{
block : 'checkbox',
mods : { theme : 'normal', size : 'm', type : 'button', disabled : true },
text : 'icon',
icon : { block : 'icon', mods : { social : 'twitter' } },
mix : [{ block : 'normal-button-icon-disabled' }]
},
{
block : 'checkbox',
mods : { theme : 'normal', size : 'm', type : 'button', disabled : true, checked : true },
text : 'icon',
icon : { block : 'icon', mods : { social : 'twitter' } },
mix : [{ block : 'normal-button-icon-disabled-checked' }]
}
].map(function(block) {
return {
block : 'test',
content : block
};
})
]
});
@@ -0,0 +1,5 @@
.test
{
padding: 5px;
width: 150px;
}
@@ -0,0 +1,5 @@
.test
{
padding: 5px;
width: 150px;
}
56 changes: 56 additions & 0 deletions gemini/checkbox.gemini.js
@@ -0,0 +1,56 @@
var gemini = require('gemini');

gemini.suite('checkbox', function(root) {

root.setUrl('desktop.tests/checkbox/gemini/gemini.html');

[
'default',
'normal-size_m',
'normal-button',
'normal-button-icon',
'normal-size_l'
]
.forEach(function(test) {
var checkboxSelector = '.' + test,
checkboxEnabledSelector = checkboxSelector + '-enabled',
checkboxDisabledSelector = checkboxSelector + '-disabled',
element = !!~test.indexOf('button') ? checkboxEnabledSelector : ' .checkbox__control';

gemini.suite(test + '-enabled', function(suite) {
suite
.setCaptureElements(checkboxEnabledSelector)
.before(function(actions, find) {
this.checkbox = find(checkboxEnabledSelector + element);
})
.capture('plain')
.capture('hovered', function(actions) {
actions.mouseMove(this.checkbox);
})
.capture('focused-hard', function(actions) {
actions.sendKeys(this.checkbox, 'focused-hard'); //send not empty string
})
.capture('focused-checked', function(actions) {
actions.click(this.checkbox);
})
.capture('checked', function(actions) {
actions.click('.page');
})
.capture('checked-hovered', function(actions) {
actions.mouseMove(this.checkbox);
});
});

gemini.suite(test + '-disabled', function(suite) {
suite
.setCaptureElements(checkboxDisabledSelector)
.capture('plain');
});

gemini.suite(test + '-disabled-checked', function(suite) {
suite
.setCaptureElements(checkboxDisabledSelector + '-checked')
.capture('plain');
});
});
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9d6beda

Please sign in to comment.