Sha256: 9b04c1809ac9f8e2c0cce201ba98727b995e5b1acc902a9ab02db981ab9b24a7

Contents?: true

Size: 1.93 KB

Versions: 16

Compression:

Stored size: 1.93 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2010 Apple Inc. and contributors.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

/*global module test equals context ok same */

htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');


var pane = SC.ControlTestPane.design()
  .add("basic", SC.View.extend(SC.Control, SC.Button, 
    {
      localize: YES,
      displayProperties: ['title'],
      render: function(context, firstTime) {
        this.renderTitle(context, firstTime);
      },
      title: "Hello World"
    })
  );

pane.show();

module('SC.Button ui', {
  setup: function() {
    var view = pane.view('basic');
  }
});

test("should set the innerHTML to the title", function() {
  var view = pane.view('basic');
  
  ok(view.$('label'), 'button has no label');
  var label = view.$('label');
  
  ok(label[0], 'label has no html node');
  var htmlNode = label[0];
  
  equals(htmlNode.innerHTML, 'Hello World', 'innerHTML should be set to title');
});

test("should modify the innerHTML if the title changes", function() {
  var view = pane.view('basic');
  
  SC.RunLoop.begin();
  view.set('title', 'Goodbye World');
  SC.RunLoop.end();
  
  var label = view.$('label');
  var htmlNode = label[0];
  
  equals(htmlNode.innerHTML, 'Goodbye World', 'innerHTML should be modified when title changes');
});

test("should still modify the innerHTML if the title changes and then changes back to previous value", function() {
  var view = pane.view('basic');
  
  SC.RunLoop.begin();
  view.set('title', 'Hello World');
  SC.RunLoop.end();
  
  var label = view.$('label');
  var htmlNode = label[0];
  
  equals(htmlNode.innerHTML, 'Hello World', 'innerHTML should be modified when title changes and then changes back to original value');
});

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sproutcore-1.5.0.pre.4.1 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.5.0.pre.4 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.5.0.pre.3 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.5 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.5-java lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js