Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

update hybrid archetype to 0.5.x api, jslint #830

Merged
merged 1 commit into from

2 participants

@isao

No description provided.

@caridy
Owner

+1

@isao isao merged commit 11a30cf into yahoo:develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 4, 2012
  1. @isao
This page is out of date. Refresh to see the latest.
View
18 lib/app/archetypes/app/hybrid/mojits/top_frame/controller.server.js.hb
@@ -2,6 +2,8 @@
* Copyright (c) 2012 Yahoo! Inc. All rights reserved.
*/
/*jslint anon:true, sloppy:true, nomen:true*/
+/*globals YUI*/
+
YUI.add('top_frame', function(Y, NAME) {
/**
@@ -18,10 +20,6 @@ YUI.add('top_frame', function(Y, NAME) {
*/
Y.namespace('mojito.controllers')[NAME] = {
- init: function(config) {
- this.config = config;
- },
-
/**
* Method corresponding to the 'index' action.
*
@@ -29,9 +27,10 @@ YUI.add('top_frame', function(Y, NAME) {
* to the Mojito API.
*/
index: function(ac) {
- ac.models.top_frameModelFoo.getData(function(err, data) {
+ ac.models.get('top_frameModelFoo').getData(function(err, data) {
if (err) {
- return ac.error(err);
+ ac.error(err);
+ return;
}
ac.done({
@@ -43,4 +42,9 @@ YUI.add('top_frame', function(Y, NAME) {
};
-}, '0.0.1', {requires: ['mojito', 'top_frameModelFoo']});
+}, '0.0.1', {requires: [
+ 'mojito',
+ 'mojito-assets-addon',
+ 'mojito-models-addon',
+ 'top_frameModelFoo'
+]});
View
17 lib/app/archetypes/app/hybrid/mojits/top_frame/tests/controller.server-tests.js
@@ -1,6 +1,8 @@
/*
* Copyright (c) 2012 Yahoo! Inc. All rights reserved.
*/
+/*jslint anon:true, sloppy:true, nomen:true*/
+/*globals YUI, YUITest*/
YUI.add('top_frame-tests', function(Y) {
@@ -23,13 +25,16 @@ YUI.add('top_frame-tests', function(Y) {
var ac,
modelData,
doneResults;
- modelData = { x:'y' };
+ modelData = { x: 'y' };
ac = {
models: {
- top_frameModelFoo: {
- getData: function(cb) {
- cb(null, modelData);
- }
+ get: function(modelName) {
+ A.areEqual('top_frameModelFoo', modelName, 'wrong model name');
+ return {
+ getData: function(cb) {
+ cb(null, modelData);
+ }
+ };
}
},
done: function(data) {
@@ -44,7 +49,7 @@ YUI.add('top_frame-tests', function(Y) {
A.areSame('Mojito is working.', doneResults.status);
A.isObject(doneResults.data);
A.isTrue(doneResults.data.hasOwnProperty('x'));
- A.areEqual('y', doneResults.data['x']);
+ A.areEqual('y', doneResults.data.x);
}
Something went wrong with that request. Please try again.