From 206bc79512101223d2fc3c21959b2dec9638e122 Mon Sep 17 00:00:00 2001 From: Sune Simonsen Date: Sun, 14 Apr 2019 17:33:05 +0200 Subject: [PATCH] Change the order of the attributes in the tests to make it the same as IE --- test/index.spec.js | 196 ++++++++++++++++++++++----------------------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/test/index.spec.js b/test/index.spec.js index d52d7417..abfa71e3 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -167,13 +167,13 @@ describe('unexpected-dom', () => { it('should diff multiple mismatching attributes', () => { expect( [ - '
', - '
' + '
', + '
' ], 'to produce a diff of', - '
' + '
' ); }); @@ -387,29 +387,29 @@ describe('unexpected-dom', () => { describe('with a single class passed as a string', () => { it('should succeed', () => { body.innerHTML = - ''; + ''; expect(body.firstChild, 'to have class', 'bar'); }); it('should fail with a diff', () => { body.innerHTML = - ''; + ''; expect( () => { expect(body.firstChild, 'to have class', 'quux'); }, 'to throw', 'expected\n' + - '\n' + "to have class 'quux'\n" + '\n' + 'Press me' ); }); @@ -424,23 +424,23 @@ describe('unexpected-dom', () => { it('should fail with a diff', () => { body.innerHTML = - ''; + ''; expect( () => { expect(body.firstChild, 'to have classes', ['quux', 'bar']); }, 'to throw', 'expected\n' + - '\n' + "to have classes [ 'quux', 'bar' ]\n" + '\n' + 'Press me' ); }); @@ -450,34 +450,34 @@ describe('unexpected-dom', () => { describe('with a single class passed as a string', () => { it('should succeed', () => { body.innerHTML = - ''; + ''; expect(body.firstChild, 'to only have class', 'bar'); }); it('should fail with a diff', () => { body.innerHTML = - ''; + ''; expect( () => { expect(body.firstChild, 'to only have class', 'quux'); }, 'to throw', 'expected\n' + - '\n' + "to only have class 'quux'\n" + '\n' + 'Press me' ); }); @@ -492,20 +492,20 @@ describe('unexpected-dom', () => { it('should fail with a diff', () => { body.innerHTML = - ''; + ''; expect( () => { expect(body.firstChild, 'to only have classes', ['quux', 'bar']); }, 'to throw', 'expected\n' + - '\n' + "to only have classes [ 'bar', 'quux' ]\n" + '\n' + ' { " // 'foo', // should be removed\n" + " // 'quux'\n" + ' // ]\n' + + ' id="foo"\n' + ' data-info="baz"\n' + - ' disabled\n' + '>Press me' ); }); @@ -526,7 +526,7 @@ describe('unexpected-dom', () => { describe('argument comparison', () => { it('should match exact arguments', function() { this.body.innerHTML = - ''; + ''; expect( this.body.firstChild, @@ -540,7 +540,7 @@ describe('unexpected-dom', () => { it('should fail on exact arguments not met', function() { this.body.innerHTML = - ''; + ''; const el = this.body.firstChild; expect( @@ -549,16 +549,16 @@ describe('unexpected-dom', () => { }, 'to throw', 'expected\n' + - '\n' + "to only have attributes 'id'\n" + '\n' + 'Press me' ); }); @@ -578,7 +578,7 @@ describe('unexpected-dom', () => { it('should fail on partial arguments not met', function() { this.body.innerHTML = - ''; + ''; const el = this.body.firstChild; expect( @@ -587,16 +587,16 @@ describe('unexpected-dom', () => { }, 'to throw', 'expected\n' + - '\n' + "to have attributes 'id', 'foo'\n" + '\n' + 'Press me' ); @@ -606,7 +606,7 @@ describe('unexpected-dom', () => { describe('array comparison', () => { it('should match exact arguments', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to only have attributes', [ 'id', @@ -618,7 +618,7 @@ describe('unexpected-dom', () => { it('should fail on exact arguments not met', function() { this.body.innerHTML = - ''; + ''; const el = this.body.firstChild; expect( @@ -627,30 +627,30 @@ describe('unexpected-dom', () => { }, 'to throw', 'expected\n' + - '\n' + "to only have attributes [ 'id' ]\n" + '\n' + 'Press me' ); }); it('should match partial arguments', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to have attributes', ['id', 'class']); }); it('should fail on partial arguments not met', function() { this.body.innerHTML = - ''; + ''; const el = this.body.firstChild; expect( @@ -659,16 +659,16 @@ describe('unexpected-dom', () => { }, 'to throw', 'expected\n' + - '\n' + "to have attributes [ 'id', 'foo' ]\n" + '\n' + 'Press me' ); @@ -705,7 +705,7 @@ describe('unexpected-dom', () => { describe('object comparison', () => { it('should match exact object', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to only have attributes', { id: 'foo', @@ -717,7 +717,7 @@ describe('unexpected-dom', () => { it('should fail on exact object not satisfied', function() { this.body.innerHTML = - ''; + ''; const el = this.body.firstChild; expect( @@ -728,23 +728,23 @@ describe('unexpected-dom', () => { }, 'to throw', 'expected\n' + - '\n' + "to only have attributes { id: 'foo' }\n" + '\n' + 'Press me' ); }); it('should match partial object', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to have attributes', { id: 'foo', @@ -754,7 +754,7 @@ describe('unexpected-dom', () => { it('should fail on partial object not satisfied', function() { this.body.innerHTML = - ''; + ''; const el = this.body.firstChild; expect( @@ -766,16 +766,16 @@ describe('unexpected-dom', () => { }, 'to throw', 'expected\n' + - '\n' + "to have attributes { id: 'foo', foo: 'bar' }\n" + '\n' + 'Press me' ); @@ -878,16 +878,16 @@ describe('unexpected-dom', () => { describe('lax comparison', () => { it('should do string comparisons', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to have attributes', { - style: 'color: red; background: blue' + style: 'background: blue; color: red' }); }); it('should do string comparisons in any order', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to have attributes', { style: 'background: blue; color: red' @@ -896,7 +896,7 @@ describe('unexpected-dom', () => { it('should do string comparisons on partial values', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to have attributes', { style: 'background: blue' @@ -920,7 +920,7 @@ describe('unexpected-dom', () => { it('should do object comparisons', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to have attributes', { style: { @@ -932,7 +932,7 @@ describe('unexpected-dom', () => { it('should do partial object comparisons', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to have attributes', { style: { @@ -972,16 +972,16 @@ describe('unexpected-dom', () => { describe('strict comparison', () => { it('should do string comparisons', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to only have attributes', { - style: 'color: red; background: blue' + style: 'background: blue; color: red' }); }); it('should do string comparisons in any order', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to only have attributes', { style: 'background: blue; color: red' @@ -990,7 +990,7 @@ describe('unexpected-dom', () => { it('should fail when styles are missing', function() { this.body.innerHTML = - ''; + ''; const node = this.body.firstChild; expect( @@ -1006,7 +1006,7 @@ describe('unexpected-dom', () => { it('should do object comparisons', function() { this.body.innerHTML = - ''; + ''; expect(this.body.firstChild, 'to only have attributes', { style: { @@ -1018,7 +1018,7 @@ describe('unexpected-dom', () => { it('should fail on missing partial object comparisons', function() { this.body.innerHTML = - ''; + ''; const node = this.body.firstChild; expect( @@ -1041,7 +1041,7 @@ describe('unexpected-dom', () => { describe('not to have attributes', () => { describe('when given one of more strings', () => { it('should pass if the given element does not have any the provided attribute names', () => { - body.innerHTML = '
'; + body.innerHTML = '
'; const node = body.firstChild; expect(node, 'not to have attributes', 'data-test-id', 'class'); @@ -1049,7 +1049,7 @@ describe('unexpected-dom', () => { it('should fail if the given element has one of the provided attributes', () => { body.innerHTML = - '
'; + '
'; const node = body.firstChild; expect( @@ -1057,19 +1057,19 @@ describe('unexpected-dom', () => { expect(node, 'not to have attributes', 'data-test-id', 'class'); }, 'to throw', - 'expected
\n' + + 'expected
\n' + "not to have attributes 'data-test-id', 'class'\n" + '\n' + '
' ); }); it('should fail if the given element has multiple of the provided attributes', () => { body.innerHTML = - '
'; + '
'; const node = body.firstChild; expect( @@ -1077,13 +1077,13 @@ describe('unexpected-dom', () => { expect(node, 'not to have attributes', 'data-test-id', 'class'); }, 'to throw', - 'expected
\n' + + 'expected
\n' + "not to have attributes 'data-test-id', 'class'\n" + '\n' + '
' ); }); @@ -1091,7 +1091,7 @@ describe('unexpected-dom', () => { describe('when given an array', () => { it('should pass if the given element does not have any of the provided attribute names', () => { - body.innerHTML = '
'; + body.innerHTML = '
'; const node = body.firstChild; expect(node, 'not to have attributes', ['data-test-id', 'class']); @@ -1099,7 +1099,7 @@ describe('unexpected-dom', () => { it('should fail if the given element has one of the provided attributes', () => { body.innerHTML = - '
'; + '
'; const node = body.firstChild; expect( @@ -1107,19 +1107,19 @@ describe('unexpected-dom', () => { expect(node, 'not to have attributes', ['data-test-id', 'class']); }, 'to throw', - 'expected
\n' + + 'expected
\n' + "not to have attributes [ 'data-test-id', 'class' ]\n" + '\n' + '
' ); }); it('should fail if the given element has multiple of the provided attributes', () => { body.innerHTML = - '
'; + '
'; const node = body.firstChild; expect( @@ -1127,13 +1127,13 @@ describe('unexpected-dom', () => { expect(node, 'not to have attributes', ['data-test-id', 'class']); }, 'to throw', - 'expected
\n' + + 'expected
\n' + "not to have attributes [ 'data-test-id', 'class' ]\n" + '\n' + '
' ); }); @@ -2084,7 +2084,7 @@ describe('unexpected-dom', () => { it('should fail with a diff', () => { body.innerHTML = - '
foobar
hey
'; + '
foobar
hey
'; expect( () => { expect(body, 'queried for', 'div', 'to satisfy', { @@ -2094,15 +2094,15 @@ describe('unexpected-dom', () => { 'to throw', 'expected\n' + '\n' + - '
foobar
\n' + + '
foobar
\n' + '
hey
\n' + '\n' + "queried for div to satisfy { 1: { attributes: { foo: 'bar' } } }\n" + - ' expected NodeList[
foobar
,
hey
]\n' + + ' expected NodeList[
foobar
,
hey
]\n' + " to satisfy { 1: { attributes: { foo: 'bar' } } }\n" + '\n' + ' NodeList[\n' + - '
foobar
,\n' + + '
foobar
,\n' + ' { ); }); - it('should produce a nested diff when when the outer element has a different set of attributes', () => { + it('should produce a nested diff when the outer element has a different set of attributes', () => { expect( - '
foofoo
', + '
foofoo
', 'diffed with', '
foobar
', 'to equal', '
\n' + ' foo\n' + - ' \n' + ' \n' + ' -foo\n' + @@ -2733,7 +2733,7 @@ describe('unexpected-dom', () => { it('should produce a good satisfy diff in a real world example', () => { body.innerHTML = - '