Sha256: 568c3526c23435f3a7c15350cd6ddc875c4505a1d18c9eb4a3237644957d93f3

Contents?: true

Size: 1.53 KB

Versions: 47

Compression:

Stored size: 1.53 KB

Contents

// ========================================================================
// View metrics Unit Tests
// ========================================================================
/*globals module test ok isObj equals expects */

/**
  These tests verify that all view metrics -- frame, clippingFrame,
  isVisibleInWindow, etc. are correct.
*/

// ..........................................................
// BASE TESTS
// 
// These tests exercise the API.  See below for tests that cover edge 
// conditions.  If you find a bug, we recommend that you add a test in the 
// edge case section.

var FRAME = { x: 10, y: 10, width: 30, height: 30 } ;

var pane, view ; // test globals

module("isVisibleInWindow", {
  
  setup: function() {
    pane = SC.MainPane.create() ;
    view = SC.View.create() ; 
  },
  
  teardown: function() {
    view = null ;
    pane.remove() ;
    pane = null ;
  }
  
});

test("a new view should not be visible initially", function() {
  ok(view.get('isVisible'), "view.get('isVisible') === NO") ;
});

test("adding a new view to a visible pane should make it visible", function() {
  ok(view.get('isVisible'), "view.get('isVisible') === YES") ;
  ok(pane.get('isVisible'), "pane.get('isVisible') === YES") ;
  SC.RunLoop.begin();
  pane.appendChild(view) ;
  pane.append() ;
  view.set('isVisible', NO);
  SC.RunLoop.end();
  ok(!view.get('isVisible'), "after pane.appendChild(view), view.get('isVisible') === YES") ;
  ok(view.$().hasClass('hidden'), "after view.set('isVisible', NO), view.$().hasClass('hidden') should be true") ;
});

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090720093355 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutit-sproutcore-1.0.0.20090720202429 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutit-sproutcore-1.0.0.20090721125122 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutit-sproutcore-1.0.126 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutit-sproutcore-1.0.20090721145251 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutit-sproutcore-1.0.20090721145280 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutit-sproutcore-1.0.20090721145281 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutit-sproutcore-1.0.20090721145282 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutit-sproutcore-1.0.20090721145285 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutit-sproutcore-1.0.203 frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/amber/tests/views/view/isVisible.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js