Sha256: eb55f62f998c0af803b9c00c4cbf1dbd1289bd58fddf75a99c19108715dd8ff5

Contents?: true

Size: 1.82 KB

Versions: 28

Compression:

Stored size: 1.82 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 module test equals context ok */

module("SC.View");

test("setting themeName should trigger a theme observer", function() {
  var count = 0;
  var view = SC.View.create({
    themeDidChange: function() {
      count++;
    }.observes('theme')
  });

  view.set('themeName', 'hello');
  equals(1, count, "theme observers should get called");
});

test("setting themeName should trigger a theme observer when extending", function() {
  var count = 0;
  var View = SC.View.extend({
    themeDidChange: function() {
      count++;
    }.observes('theme')
  });

  View.create().set('themeName', 'hello');
  equals(1, count, "theme observers should get called");
});

test("it still works with the backward compatible theme property", function() {
  var count = 0;
  var view = SC.View.create({
    theme: 'sc-base',
    themeDidChange: function() {
      count++;
    }.observes('theme')
  });

  equals(SC.Theme.find('sc-base'), view.get('theme'));
  view.set('themeName', 'hello');
  equals(1, count, "theme observers should get called");
});

test("it still works with the backward compatible theme property when extending", function() {
  var count = 0;
  var View = SC.View.extend({
    theme: 'sc-base',
    themeDidChange: function() {
      count++;
    }.observes('theme')
  });

  var view = View.create();
  equals(SC.Theme.find('sc-base'), view.get('theme'));
  view.set('themeName', 'hello');
  equals(1, count, "theme observers should get called");
});

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.10.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.10.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.10.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.6.0.1 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js
sproutcore-1.6.0.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js