app-test.js revision cdcb2ce76d2db25d234e316dfefc458c097eb1d9
var ArrayAssert = Y.ArrayAssert,
ObjectAssert = Y.ObjectAssert,
// -- Global Suite -------------------------------------------------------------
// -- Model Suite --------------------------------------------------------------
// -- Model: Lifecycle ---------------------------------------------------------
name: 'Lifecycle',
'Models should have `changed` and `lastChange` properties': function () {
},
'destroy() should destroy the model instance': function () {
};
},
'destroy() should call a callback if provided as the only arg': function () {
method: 'callback',
args : []
});
},
'destroy() should call a callback if provided as the second arg': function () {
method: 'callback',
args : []
});
},
'destroy() should delete the model if the `delete` option is truthy': function () {
var calls = 0,
method: 'callback',
args : []
});
calls += 1;
callback();
};
}
}));
// -- Model: Attributes --------------------------------------------------------
name: 'Attributes',
setUp: function () {
idAttribute: 'customId'
}, {
ATTRS: {
}
});
},
tearDown: function () {
delete this.TestModel;
},
'Attributes should be settable at instantiation time': function () {
},
'Custom id attribute should be settable at instantiation time': function () {
var model;
// We need to set and get the id and customId attributes in various
// orders to ensure there are no issues due to the attributes being
// lazily added.
},
'id attribute should be an alias for the custom id attribute': function () {
var calls = 0,
calls += 1;
});
},
'clientId attribute should be automatically generated': function () {
}
}));
// -- Model: Events ------------------------------------------------------------
name: 'Events',
setUp: function () {
ATTRS: {
}
});
},
tearDown: function () {
delete this.TestModel;
},
'`change` event should contain coalesced attribute changes': function () {
var calls = 0,
calls += 1;
});
foo: 'foo',
bar: 'bar'
}, {src: 'test'});
},
'`change` event should not fire when the _silent_ option is truthy': function () {
});
},
'`error` event should fire when validation fails': function () {
var calls = 0,
return 'ERROR. ERROR. DOES NOT COMPUTE.';
};
calls += 1;
});
},
'`error` event should fire when parsing fails': function () {
var calls = 0,
calls += 1;
});
}
}));
// -- Model: Methods -----------------------------------------------------------
name: 'Methods',
setUp: function () {
ATTRS: {
}
});
},
tearDown: function () {
delete this.TestModel;
},
'generateClientId() should generate a unique client id': function () {
},
'getAsHTML() should return an HTML-escaped attribute value': function () {
var value = '<div id="foo">hello!</div>',
},
'getAsURL() should return a URL-encoded attribute value': function () {
var value = 'foo & bar = baz',
},
'isModified() should return true if the model is new': function () {
},
'isModified() should return true if the model has changed since it was last saved': function () {
},
'isNew() should return true if the model is new': function () {
},
'load() should delegate to sync()': function () {
var calls = 0,
opts = {};
calls += 1;
callback();
};
},
'load() should reset this.changed when loading succeeds': function () {
},
'load() should be chainable and should call the callback if one was provided': function () {
var calls = 0,
calls += 1;
}));
calls += 1;
}));
},
'parse() should parse a JSON string and return an object': function () {
},
'parse() should not try to parse non-strings': function () {
},
'save() should delegate to sync()': function () {
var calls = 0,
opts = {};
calls += 1;
// Give the model an id so it will no longer be new.
};
calls += 1;
};
},
'save() should reset this.changed when saving succeeds': function () {
},
'save() should be chainable and should call the callback if one was provided': function () {
var calls = 0,
calls += 1;
}));
calls += 1;
}));
},
'set() should set the value of a single attribute': function () {
},
'setAttrs() should set the values of multiple attributes': function () {
},
'sync() should just call the supplied callback by default': function () {
var calls = 0,
calls += 1;
});
},
"toJSON() should return a copy of the model's attributes, minus excluded ones": function () {
// When there's a custom id attribute, the 'id' attribute should be
// excluded.
idAttribute: 'customId'
}, {
ATTRS: {
}
});
},
'undo() should revert the previous change to the model': function () {
},
'undo() should revert only the specified attributes when attributes are specified': function () {
},
'undo() should pass options to setAttrs()': function () {
var calls = 0,
calls += 1;
});
},
'undo() should do nothing when there is no previous change to revert': function () {
});
},
'validate() should be a noop function by default': function () {
},
'Setting an attribute should call validate() and fire an error if it returns a value': function () {
var calls = 0,
errors = 0,
calls += 1;
};
errors += 1;
});
}
}));
}, '@VERSION@', {
});