on
Turns all fixtures on or off. Defaults to true
for on.
fixture.on
Turns all fixtures on or off. Defaults to true
for on.
import {fixture, ajax} from "can";
fixture( "GET /todos", () => {
return "success";
} );
fixture.on = false; //-> AJAX requests will not be trapped
ajax( {url: "/todos"} ).catch( error => {
console.log("Couldn't connect.");
} );
Alternatives
To remove a fixture you can also use fixture(ajaxSetting, null)
. This method is elaborated further in can-fixture.
import {fixture, ajax} from "can";
fixture( "GET /todos", () => {
return "success";
} );
fixture( "GET /todos", null );
ajax( {url:"/todos"} ).catch( error => {
console.log("Couldn't connect.");
} );