Sha256: ba83af71cdee43b1bcc4201075f38465a0be31b9b1d3c700e62bc18286f2b5f6

Contents?: true

Size: 1.98 KB

Versions: 30

Compression:

Stored size: 1.98 KB

Contents

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

30 entries across 30 versions & 1 rubygems

Version Path
sproutcore-1.9.2 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.9.1 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.9.0 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.8.1 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.8.0 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.1 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.1-x86-mingw32 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.rc.2-x86-mingw32 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.rc.2 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.rc.2-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.rc.1-x86-mingw32 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.rc.1 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.rc.1-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.6.0.beta.3-x86-mingw32 lib/frameworks/sproutcore/apps/tests/states/ready.js