Skip to content

Commit

Permalink
Add a common util method to create component container
Browse files Browse the repository at this point in the history
Fixes #148
  • Loading branch information
ipeychev committed Mar 24, 2015
1 parent 444d3ad commit 9608b50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/ui/react/test/button-bold.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,12 @@ describe('ButtonBold', function() {

before(Utils.createAlloyEditor);

beforeEach(function() {
this.btnContainer = document.createElement('div');
beforeEach(Utils.createContainer);

document.body.appendChild(this.btnContainer);
});

afterEach(function() {
document.body.removeChild(this.btnContainer);
});
afterEach(Utils.removeContainer);

it('should make a text selection bold', function() {
var buttonBold = React.render(<global.AlloyEditor.ButtonBold editor={this.editor} />, this.btnContainer);
var buttonBold = React.render(<global.AlloyEditor.ButtonBold editor={this.editor} />, this.container);

bender.tools.selection.setWithHtml(this.nativeEditor, 'There should be a {selection} made bold.');

Expand Down
10 changes: 10 additions & 0 deletions src/ui/react/test/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@

done();
});
},

createContainer: function() {
this.container = document.createElement('div');

document.body.appendChild(this.container);
},

removeContainer: function() {
document.body.removeChild(this.container);
}
};

Expand Down

0 comments on commit 9608b50

Please sign in to comment.