Sha256: 3978c5d0c001bc017a3bd856df585901fdac70829830720664dcf50ba41d5baf

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
//            portions copyright @2009 Apple Inc.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

/*global module test htmlbody ok equals same stop start Q$ */


var pane, view;

module("SC.View#didAppendToDocument");

test("Check that didAppendToDocument gets called at the right moment", function() {
   var counter=0;
   pane = SC.MainPane.create({
     childViews: [
       SC.View.extend({
         render: function (context, firstTime) {
           context.push('new string');
         },
         didAppendToDocument: function(){
           counter++;
         }
       })
     ]
   });
   equals(counter, 0, "");
   pane.append(); // make sure there is a layer...
   equals(counter, 1, "");
   view  = pane.childViews[0];
   view.displayDidChange();
   SC.RunLoop.begin().end();
   equals(counter, 2, "");  
 
   var additionalView = SC.View.extend({
     didAppendToDocument: function(){
       counter++;
     }
   });
   additionalView = additionalView.create();
   pane.appendChild(additionalView);
 
   SC.RunLoop.begin().end();
   equals(counter, 3, "");  
   pane.remove();
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sproutcore-1.4.0.rc.5 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.0.rc.4 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.0.rc.3 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.0.rc.2 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.0.rc lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.0.1049.pre.2 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.0.1049.pre.1 frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js