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