File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ var fixture = core.add;
44var Store = require ( "./store" ) ;
55require ( "./xhr" ) ;
66var canReflect = require ( "can-reflect" ) ;
7+ var canDev = require ( "can-log/dev/dev" ) ;
78var ns = require ( "can-namespace" ) ;
89// HELPERS START
910
@@ -67,7 +68,14 @@ canReflect.assignMap(fixture, {
6768} ) ;
6869
6970if ( typeof window !== "undefined" && typeof require . resolve !== "function" ) {
70- window . fixture = fixture ;
71+ // window.fixture = fixture;
72+
73+ window . fixture = function ( ) {
74+ debugger
75+ canDev . warn ( "You using the global fixture. Make sure you import can-fixture." ) ;
76+
77+ return fixture . apply ( this , arguments ) ;
78+ } ;
7179}
7280
7381
Original file line number Diff line number Diff line change @@ -1980,3 +1980,20 @@ if ("onabort" in XMLHttpRequest._XHR.prototype) {
19801980 stop ( ) ;
19811981 } ) ;
19821982} // END onabort check
1983+
1984+
1985+
1986+ testHelpers . dev . devOnlyTest ( "window.fixture warns when called" , function ( ) {
1987+ debugger
1988+ var teardown = testHelpers . dev . willWarn ( / Y o u u s i n g t h e g l o b a l f i x t u r e \. M a k e s u r e y o u i m p o r t c a n - f i x t u r e \. / , function ( message , matched ) {
1989+ if ( matched ) {
1990+ ok ( true , "received warning" ) ;
1991+ }
1992+ } ) ;
1993+
1994+ window . fixture ( "GET /api/products" , function ( ) {
1995+ return { } ;
1996+ } ) ;
1997+
1998+ teardown ( ) ;
1999+ } ) ;
You can’t perform that action at this time.
0 commit comments