How to use the can.fixture.store 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 canjs / canjs / docs / can-guides / commitment / recipes / todomvc-with-steal / 8-fixtures / todos-fixture.js View on Github external
// models/todos-fixture.js
import { fixture } from "can";
import Todo from "./todo";

const todoStore = fixture.store(
  [
    { name: "mow lawn", complete: false, id: "5" },
    { name: "dishes", complete: true, id: "6" },
    { name: "learn canjs", complete: false, id: "7" }
  ],
  Todo
);

fixture("/api/todos/{id}", todoStore);
fixture.delay = 500;

export default todoStore;
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 canjs / canjs / demos / forms / extended-make-model-year.html View on Github external
{ id: "1", name: "Ford" },
	{ id: "2", name: "Nissan" }
],
{ identity: ["id"] }
));

fixture("/models", fixture.store([
    { id: "1", makeId: "1", name: "Mustang", years: [ 2013, 2014 ] },
    { id: "2", makeId: "1", name: "Focus", years: [ 2013, 2014 ] },
    { id: "3", makeId: "2", name: "Altima", years: [ 2013, 2014 ] },
    { id: "4", makeId: "2", name: "Leaf", years: [ 2013, 2014 ] },
],
{ identity: ["id"] }
));

fixture("/vehicles", fixture.store([
    {id: 1, modelId: "1", year: "2013", name: "2013 Mustang", thumb: "http://mustangsdaily.com/blog/wp-content/uploads/2012/07/01-2013-ford-mustang-gt-review-585x388.jpg"},
    {id: 2, modelId: "1", year: "2014", name: "2014 Mustang", thumb: "http://mustangsdaily.com/blog/wp-content/uploads/2013/03/2014-roush-mustang.jpg"},
    {id: 3, modelId: "2", year: "2013", name: "2013 Focus", thumb: "http://images.newcars.com/images/car-pictures/original/2013-Ford-Focus-Sedan-S-4dr-Sedan-Exterior.png"},
    {id: 4, modelId: "2", year: "2014", name: "2014 Focus", thumb: "http://ipinvite.iperceptions.com/Invitations/survey705/images_V2/top4.jpg"},
    {id: 5, modelId: "3", year: "2013", name: "2013 Altima", thumb: "http://www.blogcdn.com/www.autoblog.com/media/2012/04/04-2013-nissan-altima-1333416664.jpg"},
    {id: 6, modelId: "3", year: "2014", name: "2014 Altima", thumb: "http://www.blogcdn.com/www.autoblog.com/media/2012/04/01-2013-nissan-altima-ny.jpg"},
    {id: 7, modelId: "4", year: "2013", name: "2013 Leaf", thumb: "http://www.blogcdn.com/www.autoblog.com/media/2012/04/01-2013-nissan-altima-ny.jpg"},
    {id: 8, modelId: "4", year: "2014", name: "2014 Leaf", thumb: "http://images.thecarconnection.com/med/2013-nissan-leaf_100414473_m.jpg"},
],
{ identity: ["id"] }
));

class MyMmy extends StacheElement {
    static view  = `
        <select></select>
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.queryLogic);

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

export default store;
github canjs / canjs / demos / can-component / paginate.html View on Github external
url: "string"
});

Website.List = DefineList.extend({
	"#": Website,
	count: "number"
});

realtimeRestModel({
	Map: Website,
	List: Website.List,
	url: "/websites"
});


const websiteStore = fixture.store([{
	id: 1,
	name: "CanJS",
	url: "http://canjs.us"
}, {
	id: 2,
	name: "jQuery++",
	url: "http://jquerypp.com"
}, {
	id: 3,
	name: "JavaScriptMVC",
	url: "http://javascriptmvc.com"
}, {
	id: 4,
	name: "Bitovi",
	url: "http://bitovi.com"
}, {
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 / restaurants.js View on Github external
import { fixture } from 'can';
import Restaurant from '../restaurant';

const store = fixture.store([{
  _id: 1,
  name: 'Cheese City',
  slug:'cheese-city',
  address: {
    city: 'Casadina',
    state: 'CA'
  },
  images: {
    banner: "node_modules/place-my-order-assets/images/1-banner.jpg",
    owner: "node_modules/place-my-order-assets/images/2-owner.jpg",
    thumbnail: "node_modules/place-my-order-assets/images/3-thumbnail.jpg"
  }
}, {
  _id: 2,
  name: 'Crab Barn',
  slug:'crab-barn',
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 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;