Skip to content
Permalink
Browse files

Run an actual test

  • Loading branch information...
surma committed Nov 27, 2018
1 parent e596696 commit 2b6ab14ad9e4901679a6e4f5f8c25fdcb5dcabbf
Showing with 35 additions and 5 deletions.
  1. +1 −1 .gitignore
  2. +1 −1 karma.conf.js
  3. +1 −1 tests/fixtures/loading/a.js
  4. +15 −0 tests/fixtures/loading/build/runner.html
  5. +17 −2 tests/loading.test.js
@@ -1,3 +1,3 @@
tests/fixtures/*/build
tests/fixtures/*/build/*.js
node_modules
package-lock.json
@@ -17,7 +17,7 @@ module.exports = function(config) {
frameworks: ["mocha", "chai"],
files: [
{
pattern: "tests/fixtures/*",
pattern: "tests/fixtures/**",
included: false
},
{
@@ -12,5 +12,5 @@
*/

export default function() {
self.report("a");
window.parent.postMessage("a");
}
@@ -0,0 +1,15 @@
<!--
Copyright 2018 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!doctype html>
<script src="entry.js"></script>
@@ -12,7 +12,22 @@
*/

describe("Loader", function() {
it("loads transpiled modules", function() {
expect(4).to.equal(4);
beforeEach(function() {
this.ifr = document.createElement("iframe");
document.body.append(this.ifr);
});

afterEach(function() {
this.ifr.remove();
});

it("loads transpiled modules", function(done) {
window.addEventListener("message", function l(ev) {
if (ev.data === "a") {
window.removeEventListener("message", l);
done();
}
});
this.ifr.src = "/base/tests/fixtures/loading/build/runner.html";
});
});

0 comments on commit 2b6ab14

Please sign in to comment.
You can’t perform that action at this time.