Sha256: 3e0f39f96f2991dd9068bd0bf1a697cb31290cf55d12d79be84bc3ce44643790

Contents?: true

Size: 1.52 KB

Versions: 41

Compression:

Stored size: 1.52 KB

Contents

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

TestState = null;
var obj, MixinA, MixinB, stateA, stateB, stateC;

module("SC.State.plugin: Mixin Tests", {
  setup: function() {
    
    MixinA = {
      isMixinA: YES
    };
    
    MixinB = {
      isMixinB: YES
    };

    TestState = SC.State.extend({
      isTestState: YES
    });

    obj = SC.Object.create(SC.StatechartManager, {
      
      initialState: 'stateA',
      
      stateA: SC.State.plugin('TestState'),
      
      stateB: SC.State.plugin('TestState', MixinA),
      
      stateC: SC.State.plugin('TestState', MixinA, MixinB)
      
    });
    
    stateA = obj.getState('stateA');
    stateB = obj.getState('stateB');
    stateC = obj.getState('stateC');

  },
  
  teardown: function() {
    obj = TestState = MixinA = MixinB = null;
    stateA = stateB = stateC = null;
  }

});

test("check plugin state A", function() {
  ok(SC.kindOf(stateA, TestState));
  ok(stateA.get('isTestState'));
  ok(!stateA.get('isMixinA'));
  ok(!stateA.get('isMixinB'));
});

test("check plugin state B", function() {
  ok(SC.kindOf(stateB, TestState));
  ok(stateB.get('isTestState'));
  ok(stateB.get('isMixinA'));
  ok(!stateB.get('isMixinB'));
});

test("check plugin state C", function() {
  ok(SC.kindOf(stateC, TestState));
  ok(stateC.get('isTestState'));
  ok(stateC.get('isMixinA'));
  ok(stateC.get('isMixinB'));
});

Version data entries

41 entries across 41 versions & 1 rubygems

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