Sha256: 95665fec47a844a0d95b5f8d378aa74245b02ba2797007b90e7772f9aa60c78e

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 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)
// ==========================================================================

module("SC.View - backgroundColor");

test("Basic use", function() {
  var view = SC.View.create({
    backgroundColor: "red"
  });

  view.createLayer();

  equals(view.get('layer').style.backgroundColor, "red", "backgroundColor sets the CSS background-color value");

});

test("Dynamic use", function() {
  var view = SC.View.create({
    backgroundColor: 'red',
    displayProperties: ['backgroundColor']
  });
  
  view.createLayer();
  view.viewState = SC.View.ATTACHED_SHOWN; // hack to get view properties to update.

  equals(view.get('layer').style.backgroundColor, 'red', "PRELIM: backgroundColor sets the CSS background-color value");

  SC.run(function() {
    view.set('backgroundColor', 'blue');
  });

  equals(view.get('layer').style.backgroundColor, 'blue', "Changing backgroundColor when it is a display property updates the CSS background-color value");

  SC.run(function() {
    view.set('backgroundColor', null);
  });

  ok(!view.get('layer').style.backgroundColor, "Setting backgroundColor to null clears the CSS background-color value");

});

Version data entries

4 entries across 4 versions & 1 rubygems

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