Sha256: d512ab9bf363a441434aee0234e39f7953ab69b92b69d5f9561685f3b32931f2

Contents?: true

Size: 1.76 KB

Versions: 4

Compression:

Stored size: 1.76 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            ©2008-2011 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/*global ok, equals, expect, test, module*/


module("SC.Pane - childViews");

test("SC.Pane should not attempt to recompute visibility on child views that do not have visibility support", function () {
  var pane = SC.Pane.create({
    childViews: ['noVisibility'],

    noVisibility: SC.CoreView
  });

  // tomdale insists on slowing down the tests with extra scope chain traversals
  var errored = NO;

  try {
    pane.append();
  } catch (e) {
    errored = YES;
  }

  ok(!errored, "appending a pane with child views without visibility does not result in an error");
  pane.remove();

  // Clean up.
  pane.destroy();
});

test("SC.Pane should only render once when appended.", function () {
  var pane = SC.Pane.create({
    childViews: ['child'],

    paneValue: null,

    render: function () {
      ok(true, 'Render was called once on pane.');
    },

    child: SC.View.extend({
      childValueBinding: SC.Binding.oneWay('.pane.paneValue'),

      childValueDidChange: function () {
        equals(this.get('childValue'), 'bar', "Bound value should be set once to 'bar'");
      }.observes('childValue'),

      render: function () {
        ok(true, 'Render was called once on child.');
      }
    })
  });

  SC.run(function () {
    pane.append();

    pane.set('paneValue', 'foo');
    pane.set('paneValue', 'bar');
  });

  pane.remove();

  expect(3);

  // Clean up.
  pane.destroy();
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js