Sha256: 98af6220c0c80badb5c352a9110e4eb1168f33843955bed2ad9ee9840661bdee

Contents?: true

Size: 1.36 KB

Versions: 41

Compression:

Stored size: 1.36 KB

Contents

// ==========================================================================
// SC.Statechart Unit Test
// ==========================================================================
/*globals SC */

var statechart = null;

module("SC.Statechart: State - isCurrentState Property Tests", {
  setup: function() {

    statechart = SC.Statechart.create({
      
      monitorIsActive: YES,
      
      rootState: SC.State.design({
        
        initialSubstate: 'a',
        
        a: SC.State.design(),
        
        b: SC.State.design()
        
      })
      
    });
    
    statechart.initStatechart();
  },
  
  teardown: function() {
    statechart.destroy();
    statechart = null;
  }
});

test("check binding to isCurrentState", function() {
  var a = statechart.getState('a');

  var o = SC.Object.create({
    value: null,
    valueBinding: SC.Binding.oneWay().from('isCurrentState', a)
  });
  
  SC.run();
  equals(a.get('isCurrentState'), true);
  equals(o.get('value'), true);
  
  SC.run(function() { statechart.gotoState('b'); });
  equals(a.get('isCurrentState'), false);
  equals(o.get('value'), false);
  
  SC.run(function() { statechart.gotoState('a'); });
  equals(a.get('isCurrentState'), true);
  equals(o.get('value'), true);
  
  SC.run(function() { statechart.gotoState('b'); });
  equals(a.get('isCurrentState'), false);
  equals(o.get('value'), false);

});

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.10.2 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.10.1 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.10.0 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/statechart/tests/state/is_current_state.js