Skip to content

Commit

Permalink
radio-group: Gemini write test
Browse files Browse the repository at this point in the history
  • Loading branch information
lapinp committed Jul 3, 2014
1 parent bbfb708 commit cff7b6a
Show file tree
Hide file tree
Showing 101 changed files with 219 additions and 0 deletions.
152 changes: 152 additions & 0 deletions common.blocks/radio-group/radio-group.tests/gemini.bemjson.js
@@ -0,0 +1,152 @@
({
block : 'page',
title : 'bem-components: radio-group',
mods : { theme : 'normal' },
head : [
{ elem : 'css', url : '_gemini.css' },
{ elem : 'js', url : '_gemini.js' }
],
content : [

{ tag : 'h3', content : 'default enabled' },
{ block : 'test', cls : 'default-enabled', content : {
block : 'radio-group',
name : 'default1',
options : [
{ val : 1, text : 'first' },
{ val : 2, text : 'second', checked : true }
]
} },

{ tag : 'h3', content : 'default disabled' },
{ block : 'test', cls : 'default-disabled', content : {
block : 'radio-group',
name : 'default2',
options : [
{ val : 3, text : 'third', disabled : true },
{ val : 4, text : 'four', checked : true, disabled : true }
]
} },

['m', 'l'].map(function(size) {
return [
{ tag : 'h2', content : 'size ' + size },
{ tag : 'hr' },
{ tag : 'h3', content : 'normal-enabled' },
{ block : 'test',
attrs : { style : 'padding-top: 7px;' }, cls : 'normal-' + size + '-enabled', content : {
block : 'radio-group',
name : 'normal1',
mods : { theme : 'normal', size : size },
options : [
{ val : 1, text : 'first' },
{ val : 2, text : 'second', checked : true }
]
} },

{ tag : 'h3', content : 'normal-disabled' },
{ block : 'test',
attrs : { style : 'padding-top: 7px;' }, cls : 'normal-' + size + '-disabled', content : {
block : 'radio-group',
name : 'normal2',
mods : { theme : 'normal', size : size },
options : [
{ val : 3, text : 'third', disabled : true },
{ val : 4, text : 'four', checked : true, disabled : true }
]
} },

{ tag : 'h3', content : 'line-enabled' },
{ block : 'test', cls : 'line-normal-' + size + '-enabled', content : {
block : 'radio-group',
name : 'normal-line1',
mods : { theme : 'normal', size : size, type : 'line' },
options : [
{ val : 1, text : 'first' },
{ val : 2, text : 'second', checked : true }
]
} },

{ tag : 'h3', content : 'line-disabled' },
{ block : 'test', cls : 'line-normal-' + size + '-disabled', content : {
block : 'radio-group',
name : 'normal-line2',
mods : { theme : 'normal', size : size, type : 'line' },
options : [
{ val : 3, text : 'third', disabled : true },
{ val : 4, text : 'fourth', checked : true, disabled : true }
]
} },

{ tag : 'h3', content : 'button-enabled' },
{
block : 'radio-group',
name : 'normal-button1',
mods : { theme : 'normal', size : size, type : 'button' },
options : [
{ val : 1, text : 'first' },
{ val : 2, text : 'second', checked : true }
],
cls : 'button-normal-' + size + '-enabled'
},

{ tag : 'h3', content : 'button-disabled' },
{
block : 'radio-group',
name : 'normal-button2',
mods : { theme : 'normal', size : size, type : 'button' },
options : [
{ val : 3, text : 'third', disabled : true },
{ val : 4, text : 'fourth', checked : true, disabled : true }
],
cls : 'button-normal-' + size + '-disabled'
},

{ tag : 'h3', content : 'button-icon-enabled' },
{
block : 'radio-group',
name : 'normal-button3',
mods : { theme : 'normal', size : size, type : 'button' },
cls : 'button-normal-' + size + '-icon-enabled',
options : [
{
val : 'vk',
text : 'VK',
icon : { block : 'icon', mods : { social : 'vk' } }
},
{
val : 'twitter',
text : 'Twitter',
icon : { block : 'icon', mods : { social : 'twitter' } },
checked : true
}
]
},

{ tag : 'h3', content : 'button-icon-disabled' },
{
block : 'radio-group',
name : 'normal-button4',
mods : { theme : 'normal', size : size, type : 'button' },
cls : 'button-normal-' + size + '-icon-disabled',
options : [
{
val : 'vk',
text : 'VK',
disabled : true,
icon : { block : 'icon', mods : { social : 'vk' } }
},
{
val : 'twitter',
text : 'Twitter',
disabled : true,
checked : true,
icon : { block : 'icon', mods : { social : 'twitter' } }
}
]
}
]
})

]
});
@@ -0,0 +1 @@
exports.baseLevelPath = require.resolve('../../../../../.bem/levels/blocks');
@@ -0,0 +1,5 @@
.test
{
display: inline-block;
padding-top: 5px;
}
61 changes: 61 additions & 0 deletions gemini/radio-group.gemini.js
@@ -0,0 +1,61 @@
var gemini = require('gemini');

gemini.suite('radio-group', function(root) {

root.setUrl('desktop.tests/radio-group/gemini/gemini.html');

[
//'default',
//'button-normal-m',
//'button-normal-l',
//'button-normal-m-icon',
//'button-normal-l-icon',
'normal-l'
//'normal-m',
//'line-normal-m',
//'line-normal-l'
]
.forEach(function(test) {
var radioItemSelector = '.' + test,
radioItemSelectorEnabled = radioItemSelector + '-enabled',
radioItemSelectorDisabled = radioItemSelector + '-disabled',
captureArea,
control;

if(!!~test.indexOf('button')) {
captureArea = radioItemSelectorEnabled + ' .button';
control = ' .radio';
} else {
captureArea = radioItemSelectorEnabled + ' .radio__box';
control = ' .radio__control';
}

gemini.suite(test + '-enabled', function(suite) {
suite
.setCaptureElements(radioItemSelectorEnabled, captureArea)
.before(function(actions, find) {
this.radioItem = find(radioItemSelectorEnabled + control);
})
.capture('plain')
.capture('hovered', function(actions) {
actions.mouseMove(this.radioItem);
})
.capture('down', function(actions) {
actions.mouseDown(this.radioItem);
})
.capture('up', function(actions) {
actions.mouseUp(this.radioItem);
})
.capture('focus', function(actions) {
actions.sendKeys(this.radioItem, 'focus-hard');
})
});

gemini.suite(test + '-disabled', function(suite) {
suite
.setCaptureElements(radioItemSelectorDisabled)
.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 cff7b6a

Please sign in to comment.