Comparing version 4.3.5 to 4.3.6
@@ -15,3 +15,4 @@ /* jshint asi:true */ | ||
test("Basic Map", 4, function () { | ||
QUnit.test("Basic Map", function(assert) { | ||
assert.expect(4); | ||
@@ -24,6 +25,6 @@ var state = new Map({ | ||
state.bind("change", function (ev, attr, how, val, old) { | ||
equal(attr, "category", "correct change name"); | ||
equal(how, "set"); | ||
equal(val, 6, "correct"); | ||
equal(old, 5, "correct"); | ||
assert.equal(attr, "category", "correct change name"); | ||
assert.equal(how, "set"); | ||
assert.equal(val, 6, "correct"); | ||
assert.equal(old, 5, "correct"); | ||
}); | ||
@@ -37,3 +38,4 @@ | ||
test("Nested Map", 5, function () { | ||
QUnit.test("Nested Map", function(assert) { | ||
assert.expect(5); | ||
var me = new Map({ | ||
@@ -46,9 +48,9 @@ name: { | ||
ok(me.attr("name") instanceof Map); | ||
assert.ok(me.attr("name") instanceof Map); | ||
me.bind("change", function (ev, attr, how, val, old) { | ||
equal(attr, "name.first", "correct change name"); | ||
equal(how, "set"); | ||
equal(val, "Brian", "correct"); | ||
equal(old, "Justin", "correct"); | ||
assert.equal(attr, "name.first", "correct change name"); | ||
assert.equal(how, "set"); | ||
assert.equal(val, "Brian", "correct"); | ||
assert.equal(old, "Justin", "correct"); | ||
}); | ||
@@ -62,3 +64,3 @@ | ||
test("remove attr", function () { | ||
QUnit.test("remove attr", function(assert) { | ||
var state = new Map({ | ||
@@ -69,6 +71,6 @@ category: 5, | ||
state.removeAttr("category"); | ||
deepEqual(Map.keys(state), ["productType"], "one property"); | ||
assert.deepEqual(Map.keys(state), ["productType"], "one property"); | ||
}); | ||
test("remove attr on key with dot", function () { | ||
QUnit.test("remove attr on key with dot", function(assert) { | ||
var state = new Map({ | ||
@@ -88,8 +90,8 @@ "key.with.dots": 12, | ||
state2.removeAttr("key.with.someValue"); | ||
deepEqual( Map.keys(state), ["productType"], "one property"); | ||
deepEqual( Map.keys(state2), ["key.with.dots", "key"], "two properties"); | ||
deepEqual( Map.keys( state2.key["with"] ) , [], "zero properties"); | ||
assert.deepEqual( Map.keys(state), ["productType"], "one property"); | ||
assert.deepEqual( Map.keys(state2), ["key.with.dots", "key"], "two properties"); | ||
assert.deepEqual( Map.keys( state2.key["with"] ) , [], "zero properties"); | ||
}); | ||
test("nested event handlers are not run by changing the parent property (#280)", function () { | ||
QUnit.test("nested event handlers are not run by changing the parent property (#280)", function(assert) { | ||
@@ -102,7 +104,7 @@ var person = new Map({ | ||
person.bind("name.first", function (ev, newName) { | ||
ok(false, "name.first should never be called") | ||
assert.ok(false, "name.first should never be called") | ||
//equal(newName, "hank", "name.first handler called back with correct new name") | ||
}); | ||
person.bind("name", function () { | ||
ok(true, "name event triggered") | ||
assert.ok(true, "name event triggered") | ||
}) | ||
@@ -116,3 +118,3 @@ | ||
test("cyclical objects (#521)", function () { | ||
QUnit.test("cyclical objects (#521)", function(assert) { | ||
@@ -124,5 +126,5 @@ var foo = {}; | ||
ok(true, "did not cause infinate recursion"); | ||
assert.ok(true, "did not cause infinate recursion"); | ||
ok(fooed.attr('foo') === fooed, "map points to itself") | ||
assert.ok(fooed.attr('foo') === fooed, "map points to itself") | ||
@@ -138,7 +140,7 @@ var me = { | ||
ok(ref.attr('husband') === ref.attr('friend'), "multiple properties point to the same thing") | ||
assert.ok(ref.attr('husband') === ref.attr('friend'), "multiple properties point to the same thing") | ||
}) | ||
test('_cid add to original object', function () { | ||
QUnit.test('_cid add to original object', function(assert) { | ||
var map = new Map(), | ||
@@ -150,6 +152,6 @@ obj = { | ||
map.attr('myObj', obj); | ||
ok(!obj._cid, '_cid not added to original object'); | ||
assert.ok(!obj._cid, '_cid not added to original object'); | ||
}); | ||
test("Map serialize triggers reading (#626)", function () { | ||
QUnit.test("Map serialize triggers reading (#626)", function(assert) { | ||
var old = ObservationRecorder.add; | ||
@@ -177,4 +179,4 @@ | ||
ok(attributesRead.indexOf("cats") !== -1 && attributesRead.indexOf("dogs") !== -1, "map serialization triggered __reading on all attributes"); | ||
ok(readingTriggeredForKeys, "map serialization triggered __reading for __keys"); | ||
assert.ok(attributesRead.indexOf("cats") !== -1 && attributesRead.indexOf("dogs") !== -1, "map serialization triggered __reading on all attributes"); | ||
assert.ok(readingTriggeredForKeys, "map serialization triggered __reading for __keys"); | ||
@@ -184,3 +186,4 @@ ObservationRecorder.add = old; | ||
test("Test top level attributes", 7, function () { | ||
QUnit.test("Test top level attributes", function(assert) { | ||
assert.expect(7); | ||
var test = new Map({ | ||
@@ -199,14 +202,14 @@ 'my.enable': false, | ||
equal(test.attr('my.value'), true, 'correct'); | ||
equal(test.attr('my.nested.value'), 100, 'correct'); | ||
ok(test.attr("my.nested") instanceof Map); | ||
assert.equal(test.attr('my.value'), true, 'correct'); | ||
assert.equal(test.attr('my.nested.value'), 100, 'correct'); | ||
assert.ok(test.attr("my.nested") instanceof Map); | ||
equal(test.attr('my.enable'), false, 'falsey (false) value accessed correctly'); | ||
equal(test.attr('my.item'), true, 'truthey (true) value accessed correctly'); | ||
equal(test.attr('my.count'), 0, 'falsey (0) value accessed correctly'); | ||
equal(test.attr('my.newCount'), 1, 'falsey (1) value accessed correctly'); | ||
assert.equal(test.attr('my.enable'), false, 'falsey (false) value accessed correctly'); | ||
assert.equal(test.attr('my.item'), true, 'truthey (true) value accessed correctly'); | ||
assert.equal(test.attr('my.count'), 0, 'falsey (0) value accessed correctly'); | ||
assert.equal(test.attr('my.newCount'), 1, 'falsey (1) value accessed correctly'); | ||
}); | ||
test("serializing cycles", function(){ | ||
QUnit.test("serializing cycles", function(assert) { | ||
var map1 = new Map({name: "map1"}); | ||
@@ -219,8 +222,8 @@ var map2 = new Map({name: "map2"}); | ||
var res = map1.serialize(); | ||
equal(res.name, "map1"); | ||
equal(res.map2.name, "map2"); | ||
assert.equal(res.name, "map1"); | ||
assert.equal(res.map2.name, "map2"); | ||
}); | ||
test("Unbinding from a map with no bindings doesn't throw an error (#1015)", function() { | ||
expect(0); | ||
QUnit.test("Unbinding from a map with no bindings doesn't throw an error (#1015)", function(assert) { | ||
assert.expect(0); | ||
@@ -232,7 +235,8 @@ var test = new Map({}); | ||
} catch(e) { | ||
ok(false, 'No error should be thrown'); | ||
assert.ok(false, 'No error should be thrown'); | ||
} | ||
}); | ||
test("Fast dispatch event still has target and type (#1082)", 4, function() { | ||
QUnit.test("Fast dispatch event still has target and type (#1082)", function(assert) { | ||
assert.expect(4); | ||
var data = new Map({ | ||
@@ -243,9 +247,9 @@ name: 'CanJS' | ||
data.bind('change', function(ev){ | ||
equal(ev.type, 'change'); | ||
equal(ev.target, data); | ||
assert.equal(ev.type, 'change'); | ||
assert.equal(ev.target, data); | ||
}); | ||
data.bind('name', function(ev){ | ||
equal(ev.type, 'name'); | ||
equal(ev.target, data); | ||
assert.equal(ev.type, 'name'); | ||
assert.equal(ev.target, data); | ||
}); | ||
@@ -256,3 +260,3 @@ | ||
test("map passed to Map constructor (#1166)", function(){ | ||
QUnit.test("map passed to Map constructor (#1166)", function(assert) { | ||
function y() {} | ||
@@ -265,3 +269,3 @@ | ||
var res = new Map(map); | ||
deepEqual(res.attr(), { | ||
assert.deepEqual(res.attr(), { | ||
x: 1, | ||
@@ -272,3 +276,3 @@ y: y | ||
test("constructor passed to scope is threated as a property (#1261)", function(){ | ||
QUnit.test("constructor passed to scope is threated as a property (#1261)", function(assert) { | ||
var Constructor = Construct.extend({}); | ||
@@ -282,6 +286,6 @@ | ||
equal(m.attr("Todo"), Constructor); | ||
assert.equal(m.attr("Todo"), Constructor); | ||
}); | ||
test('_bindings count maintained after calling .off() on undefined property (#1490) ', function () { | ||
QUnit.test('_bindings count maintained after calling .off() on undefined property (#1490) ', function(assert) { | ||
@@ -295,22 +299,22 @@ var map = new Map({ | ||
equal(handlers.get([]).length, 1, 'The number of bindings is correct'); | ||
assert.equal(handlers.get([]).length, 1, 'The number of bindings is correct'); | ||
map.off('undefined_property'); | ||
equal(handlers.get([]).length, 1, 'The number of bindings is still correct'); | ||
assert.equal(handlers.get([]).length, 1, 'The number of bindings is still correct'); | ||
}); | ||
test("Should be able to get and set attribute named 'watch' on Map in Firefox", function() { | ||
QUnit.test("Should be able to get and set attribute named 'watch' on Map in Firefox", function(assert) { | ||
var map = new Map({}); | ||
map.attr("watch"); | ||
ok(true, "can have attribute named 'watch' on a Map instance"); | ||
assert.ok(true, "can have attribute named 'watch' on a Map instance"); | ||
}); | ||
test("Should be able to get and set attribute named 'unwatch' on Map in Firefox", function() { | ||
QUnit.test("Should be able to get and set attribute named 'unwatch' on Map in Firefox", function(assert) { | ||
var map = new Map({}); | ||
map.attr("unwatch"); | ||
ok(true, "can have attribute named 'unwatch' on a Map instance"); | ||
assert.ok(true, "can have attribute named 'unwatch' on a Map instance"); | ||
}); | ||
test('should get an empty string property value correctly', function() { | ||
QUnit.test('should get an empty string property value correctly', function(assert) { | ||
var map = new Map({ | ||
@@ -321,7 +325,7 @@ foo: 'foo', | ||
equal(map.attr(''), 'empty string'); | ||
assert.equal(map.attr(''), 'empty string'); | ||
}); | ||
test("ObserveReader - can.Construct derived classes should be considered objects, not functions (#450)", function() { | ||
QUnit.test("ObserveReader - can.Construct derived classes should be considered objects, not functions (#450)", function(assert) { | ||
var foostructor = Map.extend({ text: "bar" }, {}), | ||
@@ -338,6 +342,6 @@ obj = { | ||
read = observeReader.read(obj, observeReader.reads("next_level.thing.self.text") ); | ||
equal(read.value, "bar", "static properties on a can.Construct-based function"); | ||
assert.equal(read.value, "bar", "static properties on a can.Construct-based function"); | ||
read = observeReader.read(obj, observeReader.reads("next_level.thing.self"), { isArgument: true }); | ||
ok(read.value === foostructor, "arguments shouldn't be executed"); | ||
assert.ok(read.value === foostructor, "arguments shouldn't be executed"); | ||
@@ -403,3 +407,4 @@ }); | ||
test("works with can-reflect", 7, function(){ | ||
QUnit.test("works with can-reflect", function(assert) { | ||
assert.expect(7); | ||
var b = new Map({ "foo": "bar" }); | ||
@@ -412,6 +417,6 @@ var c = new (Map.extend({ | ||
QUnit.equal( canReflect.getKeyValue(b, "foo"), "bar", "unbound value"); | ||
assert.equal( canReflect.getKeyValue(b, "foo"), "bar", "unbound value"); | ||
function bazHandler(newValue){ | ||
QUnit.equal(newValue, "quux", "observed new value on baz"); | ||
assert.equal(newValue, "quux", "observed new value on baz"); | ||
@@ -422,3 +427,3 @@ // Turn off the "foo" handler but "thud" should still be bound. | ||
function thudHandler(newValue){ | ||
QUnit.equal(newValue, "quux", "observed new value on thud"); | ||
assert.equal(newValue, "quux", "observed new value on thud"); | ||
@@ -428,5 +433,5 @@ // Turn off the "foo" handler but "thud" should still be bound. | ||
} | ||
QUnit.ok(!canReflect.isValueLike(c), "isValueLike is false"); | ||
QUnit.ok(canReflect.isMapLike(c), "isMapLike is true"); | ||
QUnit.ok(!canReflect.isListLike(c), "isListLike is false"); | ||
assert.ok(!canReflect.isValueLike(c), "isValueLike is false"); | ||
assert.ok(canReflect.isMapLike(c), "isMapLike is true"); | ||
assert.ok(!canReflect.isListLike(c), "isListLike is false"); | ||
@@ -440,3 +445,3 @@ canReflect.onKeyValue(c, "baz", bazHandler); | ||
QUnit.equal( canReflect.getKeyValue(c, "baz"), "quux", "bound value"); | ||
assert.equal( canReflect.getKeyValue(c, "baz"), "quux", "bound value"); | ||
// sanity checks to ensure that handler doesn't get called again. | ||
@@ -448,3 +453,3 @@ b.attr("foo", "thud"); | ||
QUnit.test("onKeyValue and queues", function(){ | ||
QUnit.test("onKeyValue and queues", function(assert) { | ||
var b = new Map({ "foo": "bar" }); | ||
@@ -462,13 +467,13 @@ var order = []; | ||
queues.batch.stop(); | ||
QUnit.deepEqual(order,["onKeyValue", "mutate"]); | ||
assert.deepEqual(order,["onKeyValue", "mutate"]); | ||
}); | ||
QUnit.test("can-reflect setKeyValue", function(){ | ||
QUnit.test("can-reflect setKeyValue", function(assert) { | ||
var a = new Map({ "a": "b" }); | ||
canReflect.setKeyValue(a, "a", "c"); | ||
QUnit.equal(a.attr("a"), "c", "setKeyValue"); | ||
assert.equal(a.attr("a"), "c", "setKeyValue"); | ||
}); | ||
QUnit.test("can-reflect getKeyDependencies", function() { | ||
QUnit.test("can-reflect getKeyDependencies", function(assert) { | ||
var a = new Map({ "a": "a" }); | ||
@@ -482,7 +487,7 @@ var b = new (Map.extend({ | ||
ok(canReflect.getKeyDependencies(b, "a"), "Dependencies on computed attr"); | ||
ok(!canReflect.getKeyDependencies(b, "b"), "No dependencies on data attr"); | ||
assert.ok(canReflect.getKeyDependencies(b, "a"), "Dependencies on computed attr"); | ||
assert.ok(!canReflect.getKeyDependencies(b, "b"), "No dependencies on data attr"); | ||
b.on("a", function() {}); | ||
ok(canReflect.getKeyDependencies(b, "a").valueDependencies.has(b._computedAttrs.a.compute), "dependencies returned"); | ||
ok( | ||
assert.ok(canReflect.getKeyDependencies(b, "a").valueDependencies.has(b._computedAttrs.a.compute), "dependencies returned"); | ||
assert.ok( | ||
canReflect.getValueDependencies(b._computedAttrs.a.compute).valueDependencies, | ||
@@ -494,13 +499,13 @@ "dependencies returned from compute" | ||
QUnit.test("registered symbols", function() { | ||
QUnit.test("registered symbols", function(assert) { | ||
var a = new Map({ "a": "a" }); | ||
ok(a[canSymbol.for("can.isMapLike")], "can.isMapLike"); | ||
equal(a[canSymbol.for("can.getKeyValue")]("a"), "a", "can.getKeyValue"); | ||
assert.ok(a[canSymbol.for("can.isMapLike")], "can.isMapLike"); | ||
assert.equal(a[canSymbol.for("can.getKeyValue")]("a"), "a", "can.getKeyValue"); | ||
a[canSymbol.for("can.setKeyValue")]("a", "b"); | ||
equal(a.attr("a"), "b", "can.setKeyValue"); | ||
assert.equal(a.attr("a"), "b", "can.setKeyValue"); | ||
function handler(val) { | ||
equal(this, a); | ||
equal(val, "c", "can.onKeyValue"); | ||
assert.equal(this, a); | ||
assert.equal(val, "c", "can.onKeyValue"); | ||
} | ||
@@ -521,3 +526,3 @@ | ||
QUnit.test("can.isBound", function(){ | ||
QUnit.test("can.isBound", function(assert) { | ||
var Person = Map.extend({ | ||
@@ -528,3 +533,3 @@ first: "any", | ||
var p = new Person(); | ||
QUnit.ok(! p[canSymbol.for("can.isBound")](), "not bound"); | ||
assert.ok(! p[canSymbol.for("can.isBound")](), "not bound"); | ||
}); | ||
@@ -578,3 +583,3 @@ | ||
QUnit.test(".attr(props) should overwrite if _legacyAttrBehavior is true (#112)", function(){ | ||
QUnit.test(".attr(props) should overwrite if _legacyAttrBehavior is true (#112)", function(assert) { | ||
Map.prototype._legacyAttrBehavior = true; | ||
@@ -596,8 +601,8 @@ | ||
delete Map.prototype._legacyAttrBehavior; | ||
QUnit.equal(changes,1, "caused a change event"); | ||
assert.equal(changes,1, "caused a change event"); | ||
QUnit.equal(myMap1Instance.attr("prop1"), map2, "overwrite with maps"); | ||
assert.equal(myMap1Instance.attr("prop1"), map2, "overwrite with maps"); | ||
}); | ||
QUnit.test(".attr() leaves typed instances alone if _legacyAttrBehavior is true (#111)", function(){ | ||
QUnit.test(".attr() leaves typed instances alone if _legacyAttrBehavior is true (#111)", function(assert) { | ||
@@ -618,3 +623,3 @@ Map.prototype._legacyAttrBehavior = true; | ||
QUnit.equal( myMap.attr().myClass, myMap.attr("myClass") ) | ||
assert.equal( myMap.attr().myClass, myMap.attr("myClass") ) | ||
@@ -624,3 +629,3 @@ delete Map.prototype._legacyAttrBehavior; | ||
QUnit.test(".serialize() leaves typed instances alone if _legacyAttrBehavior is true", function(){ | ||
QUnit.test(".serialize() leaves typed instances alone if _legacyAttrBehavior is true", function(assert) { | ||
function MyClass(value) { | ||
@@ -636,6 +641,6 @@ this.value = value; | ||
var ser = myMap.serialize(); | ||
QUnit.equal(ser.myClass, myMap.attr("myClass")); | ||
assert.equal(ser.myClass, myMap.attr("myClass")); | ||
}); | ||
QUnit.test("keys with undefined values should not be dropped (#118)", function() { | ||
QUnit.test("keys with undefined values should not be dropped (#118)", function(assert) { | ||
// handles new instances | ||
@@ -649,6 +654,6 @@ var obj1 = { "keepMe": undefined }; | ||
QUnit.deepEqual(keys, ["keepMe", "foo"]) | ||
assert.deepEqual(keys, ["keepMe", "foo"]) | ||
}); | ||
QUnit.test("Can assign nested properties that are not CanMaps", function(){ | ||
QUnit.test("Can assign nested properties that are not CanMaps", function(assert) { | ||
var MyType = function() { | ||
@@ -673,5 +678,5 @@ this.one = 'one'; | ||
// Did an assign | ||
QUnit.equal(map.attr("prop.one"), "1"); | ||
QUnit.equal(map.attr("prop.two"), "2"); | ||
QUnit.equal(map.attr("prop.three"), "three"); | ||
assert.equal(map.attr("prop.one"), "1"); | ||
assert.equal(map.attr("prop.two"), "2"); | ||
assert.equal(map.attr("prop.three"), "three"); | ||
@@ -683,5 +688,5 @@ // An update | ||
QUnit.equal(map.attr("prop.one"), "one"); | ||
QUnit.equal(map.attr("prop.two"), "two"); | ||
QUnit.equal(map.attr("prop.three"), undefined); | ||
assert.equal(map.attr("prop.one"), "one"); | ||
assert.equal(map.attr("prop.two"), "two"); | ||
assert.equal(map.attr("prop.three"), undefined); | ||
}); |
{ | ||
"name": "can-map", | ||
"version": "4.3.5", | ||
"version": "4.3.6", | ||
"description": "Observable Objects", | ||
@@ -59,3 +59,3 @@ "homepage": "http://canjs.com", | ||
"steal": "^2.1.3", | ||
"steal-qunit": "^1.0.1", | ||
"steal-qunit": "^2.0.0", | ||
"steal-tools": "^2.0.4", | ||
@@ -62,0 +62,0 @@ "testee": "^0.9.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
84347
1676
0