diff --git a/fixture.js b/fixture.js index e7b2733..c576296 100644 --- a/fixture.js +++ b/fixture.js @@ -4,6 +4,7 @@ var fixture = core.add; var Store = require("./store"); require("./xhr"); var canReflect = require("can-reflect"); +var canDev = require("can-log/dev/dev"); var ns = require("can-namespace"); // HELPERS START @@ -67,7 +68,14 @@ canReflect.assignMap(fixture, { }); if(typeof window !== "undefined" && typeof require.resolve !== "function") { - window.fixture = fixture; + // window.fixture = fixture; + + window.fixture = function(){ + debugger + canDev.warn("You using the global fixture. Make sure you import can-fixture."); + + return fixture.apply(this, arguments); + }; } diff --git a/test/fixture_test.js b/test/fixture_test.js index 0b604ca..d53e983 100644 --- a/test/fixture_test.js +++ b/test/fixture_test.js @@ -1980,3 +1980,20 @@ if ("onabort" in XMLHttpRequest._XHR.prototype) { stop(); }); } // END onabort check + + + +testHelpers.dev.devOnlyTest("window.fixture warns when called", function() { + debugger + var teardown = testHelpers.dev.willWarn(/You using the global fixture\. Make sure you import can-fixture\./, function(message, matched) { + if(matched) { + ok(true, "received warning"); + } + }); + + window.fixture("GET /api/products", function(){ + return {}; + }); + + teardown(); +});