can-attribute-observable
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -7,2 +7,3 @@ var testHelpers = require("../test/helpers"); | ||
var queues = require("can-queues"); | ||
var dev = require("can-test-helpers").dev; | ||
@@ -196,2 +197,16 @@ var mock = function(obj, fnName) { | ||
}); | ||
dev.devOnlyTest("Warns when setting [type=date] value to a Date", function(assert) { | ||
var input = document.createElement("input"); | ||
input.type = "date"; | ||
var ta = this.fixture; | ||
ta.appendChild(input); | ||
var obs = new AttributeObservable(input, "value"); | ||
var undo = dev.willWarn(/valueAsDate/); | ||
obs.set(new Date()); | ||
assert.equal(undo(), 1, "Warned to use valueAsDate instead"); | ||
}); | ||
}); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
var setData = require("can-dom-data"); | ||
var dev = require("can-log/dev/dev"); | ||
var domEvents = require("can-dom-events"); | ||
@@ -361,2 +362,3 @@ var domMutate = require("can-dom-mutate"); | ||
set: function(value){ | ||
var providedValue = value; | ||
var nodeName = this.nodeName.toLowerCase(); | ||
@@ -395,2 +397,12 @@ if(nodeName === "input" || nodeName === "textarea") { | ||
} | ||
// Warnings area | ||
//!steal-remove-start | ||
if(process.env.NODE_ENV !== "production") { | ||
var settingADateInputToADate = nodeName === "input" && this.type === "date" && (providedValue instanceof Date); | ||
if(settingADateInputToADate) { | ||
dev.warn("Binding a Date to the \"value\" property on an <input type=\"date\"> will not work as expected. Use valueAsDate:bind instead. See https://canjs.com/doc/guides/forms.html#Dateinput for more information."); | ||
} | ||
} | ||
//!steal-remove-end | ||
}, | ||
@@ -397,0 +409,0 @@ test: function(){ |
{ | ||
"name": "can-attribute-observable", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Create observables from HTML attributes.", | ||
@@ -25,2 +25,3 @@ "main": "can-attribute-observable", | ||
"devDependencies": { | ||
"can-test-helpers": "^1.1.4", | ||
"can-vdom": "^4.0.1", | ||
@@ -41,2 +42,3 @@ "detect-cyclic-packages": "^1.1.1", | ||
"can-globals": "^1.0.1", | ||
"can-log": "^1.0.2", | ||
"can-observation": "^4.0.1", | ||
@@ -43,0 +45,0 @@ "can-observation-recorder": "^1.0.2", |
@@ -51,3 +51,3 @@ var globals = require("can-globals"); | ||
var div = doc.createElement("div"); | ||
var undo = domMutate.onNodeInsertion(div, function () { | ||
var undo = domMutate.onNodeConnected(div, function () { | ||
undo(); | ||
@@ -54,0 +54,0 @@ doc.body.removeChild(div); |
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
50738
1181
15
7
5
+ Addedcan-log@^1.0.2