How to use the can.fixture function in can

To help you get started, we’ve selected a few can examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github donejs / donejs / guides / place-my-order / steps / create-test / cities.js View on Github external
import { fixture } from 'can';
import City from '../city';

const store = fixture.store([
  { state: 'CA', name: 'Casadina' },
  { state: 'NT', name: 'Alberny' }
], City.connection.queryLogic);

fixture('/api/cities/{name}', store);

export default store;
github donejs / donejs / guides / place-my-order / steps / create-test / states.js View on Github external
import { fixture } from 'can';
import State from '../state';

const store = fixture.store([
  { name: 'Calisota', short: 'CA' },
  { name: 'New Troy', short: 'NT'}
], State.connection.queryLogic);

fixture('/api/states/{short}', store);

export default store;
github donejs / place-my-order / src / models / fixtures / cities.js View on Github external
import { fixture } from 'can';
import City from '../city';

const store = fixture.store([
  { state: 'CA', name: 'Casadina' },
  { state: 'NT', name: 'Alberny' }
], City.connection.queryLogic);

fixture('/api/cities/{name}', store);

export default store;
github canjs / canjs / demos / can-component / paginate.html View on Github external
url: "http://jsfiddle.net"
}, {
	id: 14,
	name: "Zepto",
	url: "http://zepto.com"
}, {
	id: 15,
	name: "Spill",
	url: "http://spill.com"
}, {
	id: 16,
	name: "Github",
	url: "http://github.com"
}] );

fixture("/websites/{id}", websiteStore);

fixture.delay = 2000;

const Paginate = DefineMap.extend({
	count: {
		default: Infinity
	},
	offset: {
		default: 0,
		set: function(newOffset) {
			return newOffset < 0 ?
				0 :
				Math.min(newOffset, !isNaN(this.count - 1) ?
					this.count - 1 :
					Infinity);
		}
github donejs / place-my-order / src / models / fixtures / orders.js View on Github external
import { fixture } from 'can';
import Order from '../order';

const store = fixture.store([{
  _id: 0,
  description: 'First item'
}, {
  _id: 1,
  description: 'Second item'
}], Order.connection.algebra);

fixture('/api/orders/{_id}', store);

export default store;
github donejs / place-my-order / src / models / fixtures / states.js View on Github external
import { fixture } from 'can';
import State from '../state';

const store = fixture.store([
  { name: 'Calisota', short: 'CA' },
  { name: 'New Troy', short: 'NT'}
], State.connection.queryLogic);

fixture('/api/states/{short}', store);

export default store;