can-event-dom-radiochange
Advanced tools
Comparing version 0.0.2 to 1.0.0
@@ -5,2 +5,4 @@ 'use strict'; | ||
var domEvents = require('can-dom-events'); | ||
var oldEvents = require('can-util/dom/events/events'); | ||
var definition = require('./can-event-dom-radiochange'); | ||
var compat = require('./compat'); | ||
@@ -12,4 +14,23 @@ | ||
var overrideStrategy = { | ||
name: 'override()', | ||
// Fix oldEvent calls to match new syntax | ||
function newifyOldEvents (oldEvents) { | ||
return { | ||
addEventListener: function (target) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
return oldEvents.addEventListener.apply(target, args); | ||
}, | ||
removeEventListener: function (target) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
return oldEvents.removeEventListener.apply(target, args); | ||
}, | ||
dispatch: function (target) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
return oldEvents.dispatch.apply(target, args); | ||
}, | ||
}; | ||
} | ||
var compatWithNew = { | ||
name: 'compat with can-dom-events', | ||
domEvents: domEvents, | ||
setup: function () { | ||
@@ -23,2 +44,30 @@ this.removeEvent = compat(domEvents); | ||
var compatWithOld = { | ||
name: 'compat with can-util/dom/events', | ||
domEvents: newifyOldEvents(oldEvents), | ||
setup: function () { | ||
this.removeEvent = compat(oldEvents); | ||
}, | ||
teardown: function () { | ||
this.removeEvent(); | ||
} | ||
}; | ||
var rawNewDomEvents = { | ||
name: 'plain with can-dom-events', | ||
domEvents: domEvents, | ||
setup: function () { | ||
this.removeEvent = domEvents.addEvent(definition); | ||
}, | ||
teardown: function () { | ||
this.removeEvent(); | ||
} | ||
}; | ||
var suites = [ | ||
compatWithOld, | ||
compatWithNew, | ||
rawNewDomEvents | ||
]; | ||
function runTests (mod) { | ||
@@ -30,4 +79,6 @@ QUnit.module(mod.name, { | ||
var domEvents = mod.domEvents; | ||
test("subscription to an untracked radio should call listener", function (assert) { | ||
expect(1); | ||
assert.expect(1); | ||
var listener = document.createElement('input'); | ||
@@ -55,3 +106,3 @@ listener.id = 'listener'; | ||
test("subscription to a tracked radio should call itself", function (assert) { | ||
expect(1); | ||
assert.expect(1); | ||
var radio = document.createElement('input'); | ||
@@ -73,2 +124,2 @@ radio.id = 'selfish'; | ||
runTests(overrideStrategy); | ||
suites.forEach(runTests); |
@@ -111,3 +111,3 @@ 'use strict'; | ||
/** | ||
* @module {events} can-event-radiochange | ||
* @module {events} can-event-dom-radiochange | ||
* @parent can-infrastructure | ||
@@ -114,0 +114,0 @@ * |
{ | ||
"name": "can-event-dom-radiochange", | ||
"description": "Custom radiochange event", | ||
"version": "0.0.2", | ||
"version": "1.0.0", | ||
"author": { | ||
@@ -14,3 +14,3 @@ "name": "Chris Andrejewski", | ||
"dependencies": { | ||
"can-dom-events": "0.0.3", | ||
"can-dom-events": "^1.0.2", | ||
"can-util": "^3.8.4" | ||
@@ -17,0 +17,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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17025
257
0
0
- Removedcan-dom-events@0.0.3(transitive)
Updatedcan-dom-events@^1.0.2