Sha256: a156153cd6a46204e8e39443e52cbd9419631bb6b1ef02436276626fd8c1660b

Contents?: true

Size: 1.55 KB

Versions: 19

Compression:

Stored size: 1.55 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Apple Inc. and contributors.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/*global module test equals context ok same */

module("SC.CoreView - Attribute Bindings");

test("should render and update attribute bindings", function() {
  var view = SC.View.create({
    classNameBindings: ['priority', 'isUrgent', 'isClassified:classified', 'canIgnore'],
    attributeBindings: ['type', 'exploded', 'destroyed', 'exists', 'explosions'],

    type: 'reset',
    exploded: true,
    destroyed: true,
    exists: false,
    explosions: 15
  });

  view.createLayer();
  equals(view.$().attr('type'), 'reset', "adds type attribute");
  ok(view.$().attr('exploded'), "adds exploded attribute when true");
  ok(view.$().attr('destroyed'), "adds destroyed attribute when true");
  ok(!view.$().attr('exists'), "does not add exists attribute when false");
  equals(view.$().attr('explosions'), "15", "adds integer attributes");

  view.set('type', 'submit');
  view.set('exploded', false);
  view.set('destroyed', false);
  view.set('exists', true);

  equals(view.$().attr('type'), 'submit', "updates type attribute");
  ok(!view.$().attr('exploded'), "removes exploded attribute when false");
  ok(!view.$().attr('destroyed'), "removes destroyed attribute when false");
  ok(view.$().attr('exists'), "adds exists attribute when true");
});

Version data entries

19 entries across 19 versions & 1 rubygems

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