Sha256: 8b86d450d119f451cb88796d855c6fabc2878afd321833aa779c214f07a6f229

Contents?: true

Size: 1.47 KB

Versions: 11

Compression:

Stored size: 1.47 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2010 Apple Inc. All rights reserved.
// License:   Licensed 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

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js