define('ember-test-helpers/legacy-0-6-x/test-module-for-model', ['exports', 'require', 'ember-test-helpers/legacy-0-6-x/test-module'], function (exports, _require2, _testModule) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var _class = function (_TestModule) {
_inherits(_class, _TestModule);
function _class(modelName, description, callbacks) {
_classCallCheck(this, _class);
var _this = _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this, 'model:' + modelName, description, callbacks));
_this.modelName = modelName;
_this.setupSteps.push(_this.setupModel);
return _this;
}
_createClass(_class, [{
key: 'setupModel',
value: function setupModel() {
var container = this.container;
var defaultSubject = this.defaultSubject;
var callbacks = this.callbacks;
var modelName = this.modelName;
var adapterFactory = container.factoryFor ? container.factoryFor('adapter:application') : container.lookupFactory('adapter:application');
if (!adapterFactory) {
if (requirejs.entries['ember-data/adapters/json-api']) {
adapterFactory = (0, _require2.default)('ember-data/adapters/json-api')['default'];
}
// when ember-data/adapters/json-api is provided via ember-cli shims
// using Ember Data 1.x the actual JSONAPIAdapter isn't found, but the
// above require statement returns a bizzaro object with only a `default`
// property (circular reference actually)
if (!adapterFactory || !adapterFactory.create) {
adapterFactory = DS.JSONAPIAdapter || DS.FixtureAdapter;
}
var thingToRegisterWith = this.registry || this.container;
thingToRegisterWith.register('adapter:application', adapterFactory);
}
callbacks.store = function () {
var container = this.container;
return container.lookup('service:store') || container.lookup('store:main');
};
if (callbacks.subject === defaultSubject) {
callbacks.subject = function (options) {
var container = this.container;
return Ember.run(function () {
var store = container.lookup('service:store') || container.lookup('store:main');
return store.createRecord(modelName, options);
});
};
}
}
}]);
return _class;
}(_testModule.default);
exports.default = _class;
});
# |
Change |
User |
Description |
Committed |
|
#1
|
23539 |
jenbottom |
Adding the basic code for ember test appk, created with 'ember new' command |
|
|