Sha256: a929d378addf5dfed9efbf928a2cd9dcfbb1ed58345ae5f318881db0ba986bef

Contents?: true

Size: 1.47 KB

Versions: 17

Compression:

Stored size: 1.47 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2009 Apple Inc. All rights reserved.
// License:   Licened under MIT license (see license.js)
// ==========================================================================

/*global module test equals context ok same same */

var context = null;



// ..........................................................
// attr
// 
module("SC.RenderContext#attr", {
  setup: function() {
    context = SC.RenderContext().attr({ foo: 'foo' }) ;
  }
});

test("should add passed name to value", function() {
  context.attr('bar', 'bar');
  equals(context._attrs.bar, 'bar', 'verify attr name');
});

test("should replace passed name  value in attrs", function() {
  context.attr('foo', 'bar');
  equals(context._attrs.foo, 'bar', 'verify attr name');
});

test("should return receiver", function() {
  equals(context, context.attr('foo', 'bar'));
});

test("should create attrs hash if needed", function() {
  context = SC.RenderContext().begin();
  equals(context._attrs, null, 'precondition - has no attrs');
  
  context.attr('foo', 'bar');
  equals(context._attrs.foo, 'bar', 'has styles');
});

test("should assign all attrs if a hash is passed", function() {
  context.attr({ foo: 'bar', bar: 'bar' });
  same(context._attrs, { foo: 'bar', bar: 'bar' }, 'has same styles');
});
 

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
sproutit-sproutcore-1.0.20090721145285 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1046 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1043 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1042 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1037 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1035 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1031 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1030 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1029 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1027 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1028 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1026 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1025 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1024 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1009 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1008 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.0.1003 frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js