Skip to content

Commit

Permalink
Тест #41
Browse files Browse the repository at this point in the history
  • Loading branch information
vitkarpov committed Dec 29, 2016
1 parent fb47244 commit ee60100
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions test/integration/ns.viewReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,14 +832,17 @@ describe('ns.ViewReact интеграционные тесты ->', function() {

ns.View.define('app');
ns.ViewReact.define('v-1', {
'params+': {
foo: null
},
component: {
render: function() {
return React.createElement(React.createClass({
componentDidMount: function() {
_this.nodeV1 = ReactDOM.findDOMNode(this);
_this.isViewInDOMOnComponentDidMount = document.querySelectorAll('.v-1-inner').length > 0;
},
render: function() {
return React.createElement('div', {}, 'Hello, world!');
return React.createElement('div', { className: 'v-1-inner' }, 'Hello, world!');
}
}));
}
Expand All @@ -859,28 +862,38 @@ describe('ns.ViewReact интеграционные тесты ->', function() {
return new ns.Update(ns.MAIN_VIEW, ns.layout.page('app', {}), {})
.render()
.then(function() {
expect($('body').find(this.nodeV1)).to.have.length.above(0);
expect(this.isViewInDOMOnComponentDidMount).to.be.true;
}, this);
});
it('для вложенной вьюшки', function() {
return new ns.Update(ns.MAIN_VIEW, ns.layout.page('app2', {}), {})
.render()
.then(function() {
expect($('body').find(this.nodeV1)).to.have.length.above(0);
expect(this.isViewInDOMOnComponentDidMount).to.be.true;
}, this);
});
it('для вьюшки в ns-боксе', function() {
return new ns.Update(ns.MAIN_VIEW, ns.layout.page('app3', {}), {})
.render()
.then(function() {
expect($('body').find(this.nodeV1)).to.have.length.above(0);
expect(this.isViewInDOMOnComponentDidMount).to.be.true;
}, this);
});
it('для вьюшки в реакт-боксе', function() {
return new ns.Update(ns.MAIN_VIEW, ns.layout.page('app4', {}), {})
.render()
.then(function() {
expect($('body').find(this.nodeV1)).to.have.length.above(0);
expect(this.isViewInDOMOnComponentDidMount).to.be.true;
}, this);
});
it('для второго экземпляра вьюшки в боксе', function() {
return new ns.Update(ns.MAIN_VIEW, ns.layout.page('app3', {}), {})
.render()
.then(function() {
return new ns.Update(ns.MAIN_VIEW, ns.layout.page('app3', {}), { foo: true }).render()
})
.then(function() {
expect(this.isViewInDOMOnComponentDidMount).to.be.true;
}, this);
});
});
Expand Down

0 comments on commit ee60100

Please sign in to comment.