Skip to content

Commit

Permalink
refactor(override-configuration-spec): ES6fy
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres authored and Marcos Cáceres committed Jul 5, 2017
1 parent afddef6 commit fa271f5
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions tests/spec/core/override-configuration-spec.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
"use strict";
describe("Core — Override Configuration", function() {
afterAll(function(done) {
describe("Core — Override Configuration", () => {
afterAll(done => {
flushIframes();
done();
});
it("should override a simple string setting", function(done) {
var url =
"spec/core/simple.html?specStatus=RSCND&previousMaturity=REC&previousPublishDate=1994-12-12";
var test = function(doc) {
expect($(".head h2", doc).text()).toMatch(/W3C Rescinded Recommendation/);
expect(
doc.defaultView.respecConfig.previousPublishDate.getFullYear()
).toEqual(1994);
expect(doc.defaultView.respecConfig.previousMaturity).toEqual("REC");
const simpleURL = new URL("./spec/core/simple.html", document.location);
it("overrides a simple string setting", done => {
const url = new URL(simpleURL.href);
url.searchParams.set("specStatus", "RSCND");
url.searchParams.set("previousMaturity", "REC");
url.searchParams.set("previousPublishDate", "1994-03-01");
const test = doc => {
const { respecConfig: conf } = doc.defaultView;
const { textContent } = doc.querySelector(".head h2");
expect(textContent).toMatch(/W3C Rescinded Recommendation/);
const month = conf.previousPublishDate.getUTCMonth();
expect(month).toEqual(2);
const { previousMaturity } = conf;
expect(previousMaturity).toEqual("REC");
done();
};
makeRSDoc(makeStandardOps(), test, url);
});
it("decodes URL key/values strings correctly", function(done) {
var url =
"spec/core/simple.html?additionalCopyrightHolders=Internet%20Engineering%20Task%20Force";
var test = function(doc) {
var copyrightText = doc.querySelector(".copyright").textContent;
it("decodes URL key/values strings correctly", done => {
const url = new URL(simpleURL.href);
url.searchParams.set(
"additionalCopyrightHolders",
"Internet Engineering Task Force"
);
const test = doc => {
const copyrightText = doc.querySelector(".copyright").textContent;
expect(copyrightText).toMatch(/Internet Engineering Task Force/);
done();
};
Expand Down

0 comments on commit fa271f5

Please sign in to comment.