karma-viewport
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -165,2 +165,15 @@ (function(e, a) { | ||
_createClass(Viewport, [ { | ||
key: "load", | ||
value: function load(url, cb) { | ||
var _this = this; | ||
if (typeof url !== "string" || !url.length) throw new TypeError("Invalid URL: " + (0, | ||
_inspect2.default)(url)); | ||
if (typeof cb !== "function") throw new TypeError("Invalid callback"); | ||
this.el_.onload = function() { | ||
_this.el_.onload = null; | ||
cb(); | ||
}; | ||
this.el_.src = url; | ||
} | ||
}, { | ||
key: "set", | ||
@@ -202,6 +215,6 @@ value: function set() { | ||
value: function between(first, last, cb) { | ||
var _this = this; | ||
var _this2 = this; | ||
if (typeof cb !== "function") throw new TypeError("Invalid callback"); | ||
(0, _resolve4.default)(this.config_.breakpoints, first, last).forEach(function(breakpoint) { | ||
_this.set(breakpoint.size.width, breakpoint.size.height); | ||
_this2.set(breakpoint.size.width, breakpoint.size.height); | ||
cb(breakpoint.name); | ||
@@ -208,0 +221,0 @@ }); |
{ | ||
"name": "karma-viewport", | ||
"version": "0.4.0", | ||
"description": "Karma viewport resizer", | ||
"version": "0.4.1", | ||
"description": "A Karma plugin for testing responsive layouts", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "breakpoint", |
@@ -91,4 +91,11 @@ [![Travis][travis-image]][travis-link] | ||
Note that the `iframe#viewport` element must be present in the `context.html` | ||
and `debug.html` files that are served by Karma. | ||
and `debug.html` files that are served by Karma. Using a separate, custom | ||
context makes it possible to load entire webpages for testing: | ||
``` js | ||
beforeEach(done => { | ||
viewport.load("/path/to/fixture.html", done) | ||
}) | ||
``` | ||
[3]: http://karma-runner.github.io/1.0/config/configuration-file.html | ||
@@ -95,0 +102,0 @@ |
Sorry, the diff of this file is not supported yet
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
34235
528
204