Skip to content

Commit ba146eb

Browse files
author
Roman Kartsev
committed
tests
1 parent b781cf2 commit ba146eb

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

test/spec/ns.view.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ describe('ns.View', function() {
11551155

11561156
});
11571157

1158-
describe('updateHTML', function() {
1158+
describe('#_updateHTML()', function() {
11591159

11601160
describe('redraw async view with child depens on same model', function() {
11611161

@@ -1389,6 +1389,44 @@ describe('ns.View', function() {
13891389

13901390
});
13911391

1392+
describe('обновление ноды валидного вида, вложенного в бокс', function() {
1393+
beforeEach(function() {
1394+
ns.View.define('view-1');
1395+
this.view = ns.View.create('view-1');
1396+
this.view.node = document.createElement('div');
1397+
this.view.asyncState = false;
1398+
1399+
this.newViewNode = document.createElement('div');
1400+
this.nodeFromUpdate = document.createElement('div');
1401+
1402+
this.sinon.stub(this.view, '_extractNode').withArgs(this.nodeFromUpdate).returns(this.newViewNode);
1403+
this.sinon.stub(this.view, 'isValid').returns(true);
1404+
this.sinon.stub(this.view, 'isLoading').returns(false);
1405+
this.sinon.stub(this.view, 'isOk').returns(true);
1406+
1407+
this.sinon.stub(this.view, '__onHide');
1408+
this.sinon.stub(this.view, '__onHtmldestroy');
1409+
this.sinon.stub(this.view, '_htmlinit');
1410+
this.sinon.stub(this.view, '_saveModelsVersions');
1411+
this.sinon.stub(this.view, '_show');
1412+
this.sinon.stub(this.view, '_apply');
1413+
this.sinon.stub(this.view, '_setNode');
1414+
});
1415+
1416+
it('должен подновить ноду валидного вида', function() {
1417+
var updateOptions = { toplevel: false, parent_added: true };
1418+
var events = {
1419+
'ns-view-touch': []
1420+
};
1421+
1422+
this.view._updateHTML(this.nodeFromUpdate, updateOptions, events);
1423+
1424+
expect(this.view._setNode)
1425+
.to.have.callCount(1)
1426+
.and
1427+
.to.be.calledWithExactly(this.newViewNode);
1428+
});
1429+
});
13921430
});
13931431

13941432
describe('ns.View update after model destruction', function() {

0 commit comments

Comments
 (0)