Sha256: a46ca665c0e5b901d9ef03e74d1037f7bb7e3de4eef18bdedab4151915d55eb5

Contents?: true

Size: 1.99 KB

Versions: 11

Compression:

Stored size: 1.99 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2010 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

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.4.4-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.4 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.3 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.2 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.1 lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/apps/tests/states/ready.js
sproutcore-1.4.0 lib/frameworks/sproutcore/apps/tests/states/ready.js