@@ -1155,7 +1155,7 @@ describe('ns.View', function() {
1155
1155
1156
1156
} ) ;
1157
1157
1158
- describe ( 'updateHTML ' , function ( ) {
1158
+ describe ( '#_updateHTML() ' , function ( ) {
1159
1159
1160
1160
describe ( 'redraw async view with child depens on same model' , function ( ) {
1161
1161
@@ -1389,6 +1389,44 @@ describe('ns.View', function() {
1389
1389
1390
1390
} ) ;
1391
1391
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
+ } ) ;
1392
1430
} ) ;
1393
1431
1394
1432
describe ( 'ns.View update after model destruction' , function ( ) {
0 commit comments