Skip to content

Commit 5113cdc

Browse files
committed
Make makeEnum pass the isConstructorLike test.
1 parent 5a90a54 commit 5113cdc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

can-query-logic-test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,10 @@ QUnit.test("isPaginated, removePagination", function(assert){
233233
assert.deepEqual( algebra.removePagination({page: {start: 1, end: 2}}), {}, "removePagination page");
234234

235235
});
236+
237+
QUnit.test("Value returned by makeEnum is constructorLike", function(assert){
238+
var Status = QueryLogic.makeEnum(["new", "preparing", "delivery", "delivered"]);
239+
var pass = canReflect.isConstructorLike(Status);
240+
241+
assert.ok(pass, "Status is constructor like");
242+
});

can-query-logic.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var makeBasicQueryConvert = require("./src/serializers/basic-query");
55
var BasicQuery = require("./src/types/basic-query");
66
var valueComparisons = require("./src/types/comparisons");
77
var schemaSymbol = canSymbol.for("can.getSchema");
8+
var newSymbol = canSymbol.for("can.new");
89
var makeEnum = require("./src/types/make-enum");
910

1011

@@ -173,6 +174,7 @@ QueryLogic.UNKNOWABLE = set.UNKNOWABLE;
173174

174175
QueryLogic.makeEnum = function(values){
175176
var Type = function(){};
177+
Type[newSymbol] = function(val) { return val; };
176178
makeEnum(Type, values);
177179
return Type;
178180
};

0 commit comments

Comments
 (0)