polyfills.CustomEvent.meta.json Maven / Gradle / Ivy
The newest version!
{"aliases":["default-3.3","default-3.4","default-3.5","default-3.6","default","modernizr:customevent"],"browsers":{"firefox":"6 - 10","ie":"<14","ie_mob":"10 - *","opera":"10 - 11.5","safari":"4 - 7","chrome":"1 - 14","android":"<=4.3","firefox_mob":"6 - 10"},"dependencies":["Event"],"spec":"http://dom.spec.whatwg.org/#interface-customevent","docs":"https://developer.mozilla.org/en/docs/Web/API/CustomEvent","detectSource":"'CustomEvent' in this &&\n\n// In Safari, typeof CustomEvent == 'object' but it otherwise works fine\n(typeof this.CustomEvent === 'function' ||\n(this.CustomEvent.toString().indexOf('CustomEventConstructor')>-1))","testSource":"","baseDir":"CustomEvent","hasTests":true,"testsSource":"/* eslint-env mocha, browser*/\n/* global proclaim, it */\n\n/* Not supported by the polyfill\nit('should have an initCustomEvent function', function() {\n\tproclaim.isInstanceOf(typeof CustomEvent.prototype.initCustomEvent, Function);\n});\n*/\n\n// This test is ignored as, although this feature is in the spec it does not affect users\n// Safari allows you to instantiate with no parameters, all this means is you create an event that you can never\n// listen for - pointless, but will not break anything...\nit.skip('should throw exception when instantiated with no parameters', function() {\n\tproclaim.throws(function() {\n\t\tnew CustomEvent();\n\t});\n});\n\nit('should have correct default properties', function() {\n\tvar testEvent = new CustomEvent('test');\n\tproclaim.equal(testEvent.type, 'test');\n\tproclaim.equal(testEvent.bubbles, false);\n\tproclaim.equal(testEvent.cancelable, false);\n\tproclaim.equal(testEvent.detail, null);\n});\n\nit('should modify default properties if optional CustomEventInit parameter is passed', function() {\n\tvar testEvent = new CustomEvent('test', {\n\t\tbubbles: true,\n\t\tcancelable: true,\n\t\tdetail: 'test detail'\n\t});\n\n\tproclaim.equal(testEvent.type, 'test');\n\tproclaim.equal(testEvent.bubbles, true);\n\tproclaim.equal(testEvent.cancelable, true);\n\tproclaim.equal(testEvent.detail, 'test detail');\n});\n\nit('should be able to fire an event that can be listened to', function() {\n\tvar testEvent = new CustomEvent('test', {\n\t\tbubbles: true,\n\t\tcancelable: true,\n\t\tdetail: 'test detail'\n\t});\n\n\tvar testEl = document.createElement('div');\n\ttestEl.addEventListener('test', function(ev) {\n\t\tproclaim.equal(ev.detail, 'test detail');\n\t\tproclaim.equal(ev.type, 'test');\n\t\tproclaim.equal(ev.bubbles, true);\n\t\tproclaim.equal(ev.cancelable, true);\n\t});\n\ttestEl.dispatchEvent(testEvent);\n});"}