Skip to content

Commit

Permalink
Tidies up the Tests app a little bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
publickeating committed Sep 30, 2012
1 parent 09b7507 commit f91eee8
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 136 deletions.
3 changes: 2 additions & 1 deletion apps/tests/english.lproj/strings.js
Expand Up @@ -14,8 +14,9 @@ SC.stringsFor('English', {
"Kind.app": "Apps",
"Kind.framework" : "Frameworks",
"Kind.sproutcore" : "SproutCore",
"Kind.module": "Modules",
"Kind.theme": "Themes",

"_Test Runner" : "Test Runner",
"_No Targets" : "No Targets",
"_No Tests" : "No Tests",
Expand Down
15 changes: 0 additions & 15 deletions apps/tests/tests/controllers/detail.js

This file was deleted.

15 changes: 0 additions & 15 deletions apps/tests/tests/controllers/source.js

This file was deleted.

15 changes: 0 additions & 15 deletions apps/tests/tests/controllers/target.js

This file was deleted.

15 changes: 0 additions & 15 deletions apps/tests/tests/controllers/targets.js

This file was deleted.

15 changes: 0 additions & 15 deletions apps/tests/tests/controllers/tests.js

This file was deleted.

15 changes: 0 additions & 15 deletions apps/tests/tests/models/target.js

This file was deleted.

15 changes: 0 additions & 15 deletions apps/tests/tests/models/test.js

This file was deleted.

15 changes: 0 additions & 15 deletions apps/tests/tests/views/offset_checkbox.js

This file was deleted.

35 changes: 20 additions & 15 deletions frameworks/core_tools/models/target.js
Expand Up @@ -14,12 +14,17 @@ CoreTools.Target = SC.Record.extend(
/** @scope CoreTools.Target.prototype */ {

primaryKey: "name",


/**
Kind of target.
*/
kind: SC.Record.attr(String),

/**
Name of target. This is also the primary key.
*/
name: SC.Record.attr(String),

/**
Parent of target. Only non-null for nested targets.
*/
Expand All @@ -29,39 +34,39 @@ CoreTools.Target = SC.Record.extend(
URL to use to load tests.
*/
testsUrl: SC.Record.attr(String, { key: "link_tests" }),
/**

/**
URL to use to load the app. If no an app, returns null
*/
appUrl: function() {
return (this.get('kind') === 'app') ? CoreTools.attachUrlPrefix(this.get('name')) : null;
}.property('kind', 'name').cacheable(),

/**
The isExpanded state. Defaults to NO on load.
*/
isExpanded: SC.Record.attr(Boolean, { defaultValue: NO }),

/**
Children of this target. Computed by getting the loaded targets
*/
children: function() {
var store = this.get('store'),
query = CoreTools.TARGETS_QUERY,
ret = store.find(query).filterProperty('parent', this);

if (ret) ret = ret.sortProperty('kind', 'displayName');
return (ret && ret.get('length')>0) ? ret : null ;
}.property().cacheable(),

/**
Display name for this target
*/
displayName: function() {
var name = (this.get('name') || '(unknown)').split('/');
return name[name.length-1];
}.property('name').cacheable(),

/**
The icon to display. Based on the type.
*/
Expand All @@ -71,14 +76,14 @@ CoreTools.Target = SC.Record.extend(
case "framework":
ret = 'sc-icon-folder-16';
break;

case "app":
ret = 'sc-icon-options-16';
break;
}
return ret ;
}.property('kind').cacheable(),

/**
This is the group key used to display. Will be the kind unless the item
belongs to the sproutcore target.
Expand All @@ -89,20 +94,20 @@ CoreTools.Target = SC.Record.extend(
if (parent && (parent.get('name') === '/sproutcore')) return 'sproutcore';
else return (this.get('kind') || 'unknown').toLowerCase();
}.property('kind', 'parent').cacheable(),


testsQuery: function() {
return SC.Query.remote(CoreTools.Test, { url: this.get('testsUrl') });
}.property('testsUrl').cacheable(),

/**
Returns all of the tests associated with this target by fetching the
testsUrl.
*/
tests: function() {
return this.get('store').find(this.get('testsQuery'));
}.property('testsQuery').cacheable()

}) ;

CoreTools.TARGETS_QUERY = SC.Query.remote(CoreTools.Target);

0 comments on commit f91eee8

Please sign in to comment.