Sha256: 862caf5059c6158cf7940f62fce77d61d1d01c53cff2036bed906c799bb3fce2

Contents?: true

Size: 1.35 KB

Versions: 11

Compression:

Stored size: 1.35 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2010 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

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js