add prettier and eslint
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,19 @@
|
||||
describe("jasmineUnderTest.HtmlSpecFilter", function() {
|
||||
|
||||
it("should match when no string is provided", function() {
|
||||
describe('jasmineUnderTest.HtmlSpecFilter', function() {
|
||||
it('should match when no string is provided', function() {
|
||||
var specFilter = new jasmineUnderTest.HtmlSpecFilter();
|
||||
|
||||
expect(specFilter.matches("foo")).toBe(true);
|
||||
expect(specFilter.matches("*bar")).toBe(true);
|
||||
expect(specFilter.matches('foo')).toBe(true);
|
||||
expect(specFilter.matches('*bar')).toBe(true);
|
||||
});
|
||||
|
||||
it("should only match the provided string", function() {
|
||||
it('should only match the provided string', function() {
|
||||
var specFilter = new jasmineUnderTest.HtmlSpecFilter({
|
||||
filterString: function() { return "foo"; }
|
||||
filterString: function() {
|
||||
return 'foo';
|
||||
}
|
||||
});
|
||||
|
||||
expect(specFilter.matches("foo")).toBe(true);
|
||||
expect(specFilter.matches("bar")).toBe(false);
|
||||
expect(specFilter.matches('foo')).toBe(true);
|
||||
expect(specFilter.matches('bar')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
describe("MatchersSpec - HTML Dependent", function () {
|
||||
describe('MatchersSpec - HTML Dependent', function() {
|
||||
var env, spec;
|
||||
|
||||
beforeEach(function() {
|
||||
env = new jasmineUnderTest.Env();
|
||||
|
||||
var suite = env.describe("suite", function() {
|
||||
spec = env.it("spec", function() {
|
||||
});
|
||||
env.describe('suite', function() {
|
||||
spec = env.it('spec', function() {});
|
||||
});
|
||||
spyOn(spec, 'addExpectationResult');
|
||||
|
||||
@@ -28,10 +27,10 @@ describe("MatchersSpec - HTML Dependent", function () {
|
||||
return spec.addExpectationResult.mostRecentCall.args[1];
|
||||
}
|
||||
|
||||
xit("toEqual with DOM nodes", function() {
|
||||
xit('toEqual with DOM nodes', function() {
|
||||
var nodeA = document.createElement('div');
|
||||
var nodeB = document.createElement('div');
|
||||
expect((match(nodeA).toEqual(nodeA))).toPass();
|
||||
expect((match(nodeA).toEqual(nodeB))).toFail();
|
||||
expect(match(nodeA).toEqual(nodeA)).toPass();
|
||||
expect(match(nodeA).toEqual(nodeB)).toFail();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
describe("jasmineUnderTest.pp (HTML Dependent)", function () {
|
||||
it("should stringify non-element HTML nodes properly", function() {
|
||||
var sampleNode = document.createTextNode("");
|
||||
expect(jasmineUnderTest.pp(sampleNode)).toEqual("HTMLNode");
|
||||
expect(jasmineUnderTest.pp({foo: sampleNode})).toEqual("Object({ foo: HTMLNode })");
|
||||
describe('jasmineUnderTest.pp (HTML Dependent)', function() {
|
||||
it('should stringify non-element HTML nodes properly', function() {
|
||||
var sampleNode = document.createTextNode('');
|
||||
expect(jasmineUnderTest.pp(sampleNode)).toEqual('HTMLNode');
|
||||
expect(jasmineUnderTest.pp({ foo: sampleNode })).toEqual(
|
||||
'Object({ foo: HTMLNode })'
|
||||
);
|
||||
});
|
||||
|
||||
it("should stringify empty HTML elements as their opening tags", function () {
|
||||
it('should stringify empty HTML elements as their opening tags', function() {
|
||||
var simple = document.createElement('div');
|
||||
simple.className = 'foo';
|
||||
expect(jasmineUnderTest.pp(simple)).toEqual('<div class="foo">');
|
||||
});
|
||||
|
||||
it("should stringify non-empty HTML elements as tags with placeholders", function() {
|
||||
it('should stringify non-empty HTML elements as tags with placeholders', function() {
|
||||
var nonEmpty = document.createElement('div');
|
||||
nonEmpty.className = 'foo';
|
||||
nonEmpty.innerHTML = '<p>Irrelevant</p>';
|
||||
@@ -19,14 +21,20 @@ describe("jasmineUnderTest.pp (HTML Dependent)", function () {
|
||||
});
|
||||
|
||||
it("should print Firefox's wrapped native objects correctly", function() {
|
||||
if(jasmine.getEnv().firefoxVersion) {
|
||||
try { new CustomEvent(); } catch(e) { var err = e; };
|
||||
if (jasmine.getEnv().firefoxVersion) {
|
||||
try {
|
||||
new CustomEvent();
|
||||
} catch (e) {
|
||||
var err = e;
|
||||
}
|
||||
// Different versions of FF produce different error messages.
|
||||
expect(jasmineUnderTest.pp(err)).toMatch(/Not enough arguments|CustomEvent requires at least 1 argument, but only 0 were passed/);
|
||||
expect(jasmineUnderTest.pp(err)).toMatch(
|
||||
/Not enough arguments|CustomEvent requires at least 1 argument, but only 0 were passed/
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it("should stringify HTML element with text and attributes", function() {
|
||||
it('should stringify HTML element with text and attributes', function() {
|
||||
var el = document.createElement('div');
|
||||
el.setAttribute('things', 'foo');
|
||||
el.innerHTML = 'foo';
|
||||
|
||||
@@ -1,28 +1,31 @@
|
||||
describe("QueryString", function() {
|
||||
|
||||
describe("#navigateWithNewParam", function() {
|
||||
it("sets the query string to include the given key/value pair", function() {
|
||||
describe('QueryString', function() {
|
||||
describe('#navigateWithNewParam', function() {
|
||||
it('sets the query string to include the given key/value pair', function() {
|
||||
var windowLocation = {
|
||||
search: ""
|
||||
search: ''
|
||||
},
|
||||
queryString = new jasmineUnderTest.QueryString({
|
||||
getWindowLocation: function() { return windowLocation }
|
||||
getWindowLocation: function() {
|
||||
return windowLocation;
|
||||
}
|
||||
});
|
||||
|
||||
queryString.navigateWithNewParam("foo", "bar baz");
|
||||
queryString.navigateWithNewParam('foo', 'bar baz');
|
||||
|
||||
expect(windowLocation.search).toMatch(/foo=bar%20baz/);
|
||||
});
|
||||
|
||||
it("leaves existing params alone", function() {
|
||||
it('leaves existing params alone', function() {
|
||||
var windowLocation = {
|
||||
search: "?foo=bar"
|
||||
},
|
||||
queryString = new jasmineUnderTest.QueryString({
|
||||
getWindowLocation: function() { return windowLocation }
|
||||
});
|
||||
search: '?foo=bar'
|
||||
},
|
||||
queryString = new jasmineUnderTest.QueryString({
|
||||
getWindowLocation: function() {
|
||||
return windowLocation;
|
||||
}
|
||||
});
|
||||
|
||||
queryString.navigateWithNewParam("baz", "quux");
|
||||
queryString.navigateWithNewParam('baz', 'quux');
|
||||
|
||||
expect(windowLocation.search).toMatch(/foo=bar/);
|
||||
expect(windowLocation.search).toMatch(/baz=quux/);
|
||||
@@ -30,43 +33,48 @@ describe("QueryString", function() {
|
||||
});
|
||||
|
||||
describe('#fullStringWithNewParam', function() {
|
||||
it("gets the query string including the given key/value pair", function() {
|
||||
it('gets the query string including the given key/value pair', function() {
|
||||
var windowLocation = {
|
||||
search: "?foo=bar"
|
||||
},
|
||||
queryString = new jasmineUnderTest.QueryString({
|
||||
getWindowLocation: function() { return windowLocation }
|
||||
});
|
||||
search: '?foo=bar'
|
||||
},
|
||||
queryString = new jasmineUnderTest.QueryString({
|
||||
getWindowLocation: function() {
|
||||
return windowLocation;
|
||||
}
|
||||
});
|
||||
|
||||
var result = queryString.fullStringWithNewParam("baz", "quux");
|
||||
var result = queryString.fullStringWithNewParam('baz', 'quux');
|
||||
|
||||
expect(result).toMatch(/foo=bar/);
|
||||
expect(result).toMatch(/baz=quux/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#getParam", function() {
|
||||
|
||||
it("returns the value of the requested key", function() {
|
||||
describe('#getParam', function() {
|
||||
it('returns the value of the requested key', function() {
|
||||
var windowLocation = {
|
||||
search: "?baz=quux%20corge"
|
||||
search: '?baz=quux%20corge'
|
||||
},
|
||||
queryString = new jasmineUnderTest.QueryString({
|
||||
getWindowLocation: function() { return windowLocation }
|
||||
getWindowLocation: function() {
|
||||
return windowLocation;
|
||||
}
|
||||
});
|
||||
|
||||
expect(queryString.getParam("baz")).toEqual("quux corge");
|
||||
expect(queryString.getParam('baz')).toEqual('quux corge');
|
||||
});
|
||||
|
||||
it("returns null if the key is not present", function() {
|
||||
it('returns null if the key is not present', function() {
|
||||
var windowLocation = {
|
||||
search: ""
|
||||
search: ''
|
||||
},
|
||||
queryString = new jasmineUnderTest.QueryString({
|
||||
getWindowLocation: function() { return windowLocation }
|
||||
getWindowLocation: function() {
|
||||
return windowLocation;
|
||||
}
|
||||
});
|
||||
|
||||
expect(queryString.getParam("baz")).toBeFalsy();
|
||||
expect(queryString.getParam('baz')).toBeFalsy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,61 +1,61 @@
|
||||
describe("ResultsNode", function() {
|
||||
it("wraps a result", function() {
|
||||
describe('ResultsNode', function() {
|
||||
it('wraps a result', function() {
|
||||
var fakeResult = {
|
||||
id: 123,
|
||||
message: "foo"
|
||||
message: 'foo'
|
||||
},
|
||||
node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
|
||||
node = new jasmineUnderTest.ResultsNode(fakeResult, 'suite', null);
|
||||
|
||||
expect(node.result).toBe(fakeResult);
|
||||
expect(node.type).toEqual("suite");
|
||||
expect(node.type).toEqual('suite');
|
||||
});
|
||||
|
||||
it("can add children with a type", function() {
|
||||
it('can add children with a type', function() {
|
||||
var fakeResult = {
|
||||
id: 123,
|
||||
message: "foo"
|
||||
message: 'foo'
|
||||
},
|
||||
fakeChildResult = {
|
||||
id: 456,
|
||||
message: "bar"
|
||||
message: 'bar'
|
||||
},
|
||||
node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
|
||||
node = new jasmineUnderTest.ResultsNode(fakeResult, 'suite', null);
|
||||
|
||||
node.addChild(fakeChildResult, "spec");
|
||||
node.addChild(fakeChildResult, 'spec');
|
||||
|
||||
expect(node.children.length).toEqual(1);
|
||||
expect(node.children[0].result).toEqual(fakeChildResult);
|
||||
expect(node.children[0].type).toEqual("spec");
|
||||
expect(node.children[0].type).toEqual('spec');
|
||||
});
|
||||
|
||||
it("has a pointer back to its parent ResultNode", function() {
|
||||
it('has a pointer back to its parent ResultNode', function() {
|
||||
var fakeResult = {
|
||||
id: 123,
|
||||
message: "foo"
|
||||
message: 'foo'
|
||||
},
|
||||
fakeChildResult = {
|
||||
id: 456,
|
||||
message: "bar"
|
||||
message: 'bar'
|
||||
},
|
||||
node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
|
||||
node = new jasmineUnderTest.ResultsNode(fakeResult, 'suite', null);
|
||||
|
||||
node.addChild(fakeChildResult, "spec");
|
||||
node.addChild(fakeChildResult, 'spec');
|
||||
|
||||
expect(node.children[0].parent).toBe(node);
|
||||
});
|
||||
|
||||
it("can provide the most recent child", function() {
|
||||
it('can provide the most recent child', function() {
|
||||
var fakeResult = {
|
||||
id: 123,
|
||||
message: "foo"
|
||||
message: 'foo'
|
||||
},
|
||||
fakeChildResult = {
|
||||
id: 456,
|
||||
message: "bar"
|
||||
message: 'bar'
|
||||
},
|
||||
node = new jasmineUnderTest.ResultsNode(fakeResult, "suite", null);
|
||||
node = new jasmineUnderTest.ResultsNode(fakeResult, 'suite', null);
|
||||
|
||||
node.addChild(fakeChildResult, "spec");
|
||||
node.addChild(fakeChildResult, 'spec');
|
||||
|
||||
expect(node.last()).toBe(node.children[node.children.length - 1]);
|
||||
});
|
||||
|
||||
@@ -8,7 +8,9 @@ describe('Spy Registry browser-specific behavior', function() {
|
||||
|
||||
var spies = [],
|
||||
spyRegistry = new jasmineUnderTest.SpyRegistry({
|
||||
currentSpies: function() { return spies; },
|
||||
currentSpies: function() {
|
||||
return spies;
|
||||
},
|
||||
createSpy: createSpy,
|
||||
global: window
|
||||
}),
|
||||
@@ -28,7 +30,7 @@ describe('Spy Registry browser-specific behavior', function() {
|
||||
|
||||
try {
|
||||
descriptor = Object.getOwnPropertyDescriptor(window, 'onerror');
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user