Skip to content

Commit

Permalink
Add visibility test for toolbar-styles
Browse files Browse the repository at this point in the history
Fixes #64
  • Loading branch information
jbalsas authored and ipeychev committed Jan 30, 2015
1 parent c6a56d1 commit bba96f4
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/ui/yui/test/toolbar-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,26 @@ describe('ToolbarStyles', function() {
}, done);
});

it ('should show the styles toolbar after a text selection', function(done) {
var self = this;

testToolbarVisible.call(this, {
expected: true,
html: 'The following test should be {selected}',
selector: '.alloy-editor-toolbar.alloy-editor-toolbar-styles'
}, done);
});

it ('should not show the styles toolbar after an image selection', function(done) {
var self = this;

testToolbarVisible.call(this, {
expected: false,
html: 'The following image {<img src=""></img>} should be selected',
selector: '.alloy-editor-toolbar.alloy-editor-toolbar-styles'
}, done);
});

function testButtonAction(config, callback) {
var self = this;

Expand Down Expand Up @@ -253,4 +273,18 @@ describe('ToolbarStyles', function() {
callback();
}, 150);
}

function testToolbarVisible(config, callback) {
var self = this;

bender.tools.selection.setWithHtml(self.nativeEditor, config.html);

happen.mouseup(document.getElementById('editable'));

setTimeout(function() {
assert.strictEqual($(config.selector).is(':visible'), config.expected);

callback();
}, 150);
}
});

0 comments on commit bba96f4

Please sign in to comment.