Sha256: d5f087403a7154f7ebc8bed2e0f4a1f76f506fbbcf0a226a91240192ea5982c4

Contents?: true

Size: 1.99 KB

Versions: 16

Compression:

Stored size: 1.99 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)
// ==========================================================================
/*globals TestRunner */

/**
  Initial state of application before it has loaded targets.
*/
TestRunner.READY = SC.Responder.create({
  
  /**
    Invoked when you select a target.  Set the target controller then show 
    list state if needed.
  */
  selectTarget: function(sender, target) {
    if (target && target.isEnumerable) target = target.firstObject();

    TestRunner.sourceController.selectObject(target);
    
    if (target) {
      var tests = target.get('tests');
      if (tests && (tests.get('status') & SC.Record.BUSY)) {
        TestRunner.makeFirstResponder(TestRunner.READY_LOADING);
      } else if (!tests || (tests.get('length')===0)) {
        TestRunner.makeFirstResponder(TestRunner.READY_NO_TESTS);
      } else TestRunner.makeFirstResponder(TestRunner.READY_LIST);
      
    } else TestRunner.makeFirstResponder(TestRunner.READY_EMPTY);
  },

  /**
    Invoked when you select the test.
  */
  selectTest: function(sender, test) {
    if (!TestRunner.targetController.get('hasContent')) return NO ;

    if (test && test.isEnumerable) test = test.firstObject();
    TestRunner.detailController.set('content', test);
    TestRunner.set('routeName', test ? test.get('filename') : null);

    if (test) TestRunner.makeFirstResponder(TestRunner.READY_DETAIL);
    else TestRunner.makeFirstResponder(TestRunner.READY_LIST);
  },
  
  route: function(sender, params) {
    var target = TestRunner.computeRouteTarget(),
        test   = TestRunner.computeRouteTest();

    if (test) TestRunner.sendAction('selectTest', this, test);
    else TestRunner.sendAction('selectTarget', this, target);
  }
      
});

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sproutcore-1.0.1046 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1043 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1042 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1037 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1035 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1031 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1030 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1029 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1027 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1028 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1026 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1025 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1024 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1009 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1008 frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.0.1003 frameworks/sproutcore/apps/tests/states/ready.js