"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/cssnano-utils/src/__tests__/sameParent.test.js" between
cssnano-cssnano-5.0.6.tar.gz and cssnano-cssnano-5.0.7.tar.gz

About: cssnano is a modular CSS minifier (built on top of the PostCSS ecosystem).

sameParent.test.js  (cssnano-cssnano-5.0.6):sameParent.test.js  (cssnano-cssnano-5.0.7)
import postcss from 'postcss'; import postcss from 'postcss';
import sameParent from '../sameParent'; import sameParent from '../sameParent';
test('should calculate same parent', () => { test('should calculate same parent', () => {
return postcss() return postcss()
.process('h1 {} h2 {}', { from: undefined }) .process('h1 {} h2 {}', { from: undefined, hideNothingWarning: true })
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0]; const h1 = result.root.nodes[0];
const h2 = result.root.nodes[1]; const h2 = result.root.nodes[1];
expect(sameParent(h1, h2)).toBe(true); expect(sameParent(h1, h2)).toBe(true);
}); });
}); });
test('should calculate same parent (detached nodes)', () => { test('should calculate same parent (detached nodes)', () => {
return postcss() return postcss()
.process('h1 {} h2 {}', { from: undefined }) .process('h1 {} h2 {}', { from: undefined, hideNothingWarning: true })
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0]; const h1 = result.root.nodes[0];
const h2 = result.root.nodes[1]; const h2 = result.root.nodes[1];
h1.remove(); h1.remove();
h2.remove(); h2.remove();
expect(sameParent(h1, h2)).toBe(true); expect(sameParent(h1, h2)).toBe(true);
}); });
}); });
test('should calculate same parent (at rules)', () => { test('should calculate same parent (at rules)', () => {
return postcss() return postcss()
.process('@media screen{h1 {} h2 {}}', { from: undefined }) .process('@media screen{h1 {} h2 {}}', {
from: undefined,
hideNothingWarning: true,
})
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0].nodes[0]; const h1 = result.root.nodes[0].nodes[0];
const h2 = result.root.nodes[0].nodes[1]; const h2 = result.root.nodes[0].nodes[1];
expect(sameParent(h1, h2)).toBe(true); expect(sameParent(h1, h2)).toBe(true);
}); });
}); });
test('should calculate same parent (multiple at rules)', () => { test('should calculate same parent (multiple at rules)', () => {
return postcss() return postcss()
.process('@media screen{h1 {}} @media screen{h2 {}}', { from: undefined }) .process('@media screen{h1 {}} @media screen{h2 {}}', {
from: undefined,
hideNothingWarning: true,
})
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0].nodes[0]; const h1 = result.root.nodes[0].nodes[0];
const h2 = result.root.nodes[1].nodes[0]; const h2 = result.root.nodes[1].nodes[0];
expect(sameParent(h1, h2)).toBe(true); expect(sameParent(h1, h2)).toBe(true);
}); });
}); });
test('should calculate same parent (multiple at rules (uppercase))', () => { test('should calculate same parent (multiple at rules (uppercase))', () => {
return postcss() return postcss()
.process('@media screen{h1 {}} @MEDIA screen{h2 {}}', { from: undefined }) .process('@media screen{h1 {}} @MEDIA screen{h2 {}}', {
from: undefined,
hideNothingWarning: true,
})
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0].nodes[0]; const h1 = result.root.nodes[0].nodes[0];
const h2 = result.root.nodes[1].nodes[0]; const h2 = result.root.nodes[1].nodes[0];
expect(sameParent(h1, h2)).toBe(true); expect(sameParent(h1, h2)).toBe(true);
}); });
}); });
test('should calculate same parent (nested at rules)', () => { test('should calculate same parent (nested at rules)', () => {
return postcss() return postcss()
skipping to change at line 77 skipping to change at line 86
@supports(pointer: course) { @supports(pointer: course) {
h1 {} h1 {}
} }
} }
@media screen { @media screen {
@supports(pointer: course) { @supports(pointer: course) {
h2 {} h2 {}
} }
} }
`, `,
{ from: undefined } { from: undefined, hideNothingWarning: true }
) )
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0].nodes[0].nodes[0]; const h1 = result.root.nodes[0].nodes[0].nodes[0];
const h2 = result.root.nodes[1].nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0];
expect(sameParent(h1, h2)).toBe(true); expect(sameParent(h1, h2)).toBe(true);
}); });
}); });
test('should calculate not same parent (nested at rules)', () => { test('should calculate not same parent (nested at rules)', () => {
skipping to change at line 102 skipping to change at line 111
@supports(pointer: fine) { @supports(pointer: fine) {
h1 {} h1 {}
} }
} }
@media screen { @media screen {
@supports(pointer: course) { @supports(pointer: course) {
h2 {} h2 {}
} }
} }
`, `,
{ from: undefined } { from: undefined, hideNothingWarning: true }
) )
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0].nodes[0].nodes[0]; const h1 = result.root.nodes[0].nodes[0].nodes[0];
const h2 = result.root.nodes[1].nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0];
expect(sameParent(h1, h2)).not.toBe(true); expect(sameParent(h1, h2)).not.toBe(true);
}); });
}); });
test('should calculate not same parent (nested at rules) (2)', () => { test('should calculate not same parent (nested at rules) (2)', () => {
skipping to change at line 127 skipping to change at line 136
@supports(pointer: course) { @supports(pointer: course) {
h1 {} h1 {}
} }
} }
@media screen { @media screen {
@supports(pointer: course) { @supports(pointer: course) {
h2 {} h2 {}
} }
} }
`, `,
{ from: undefined } { from: undefined, hideNothingWarning: true }
) )
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0].nodes[0].nodes[0]; const h1 = result.root.nodes[0].nodes[0].nodes[0];
const h2 = result.root.nodes[1].nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0];
expect(sameParent(h1, h2)).not.toBe(true); expect(sameParent(h1, h2)).not.toBe(true);
}); });
}); });
test('should calculate not same parent (nested at rules) (3)', () => { test('should calculate not same parent (nested at rules) (3)', () => {
skipping to change at line 150 skipping to change at line 159
` `
@supports(pointer: course) { @supports(pointer: course) {
h1 {} h1 {}
} }
@media screen { @media screen {
@supports(pointer: course) { @supports(pointer: course) {
h2 {} h2 {}
} }
} }
`, `,
{ from: undefined } { from: undefined, hideNothingWarning: true }
) )
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0].nodes[0]; const h1 = result.root.nodes[0].nodes[0];
const h2 = result.root.nodes[1].nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0];
expect(sameParent(h1, h2)).not.toBe(true); expect(sameParent(h1, h2)).not.toBe(true);
}); });
}); });
test('should calculate not same parent (nested at rules) (4)', () => { test('should calculate not same parent (nested at rules) (4)', () => {
skipping to change at line 173 skipping to change at line 182
` `
@media screen { @media screen {
h1 {} h1 {}
} }
@media screen { @media screen {
@supports(pointer: course) { @supports(pointer: course) {
h2 {} h2 {}
} }
} }
`, `,
{ from: undefined } { from: undefined, hideNothingWarning: true }
) )
.then((result) => { .then((result) => {
const h1 = result.root.nodes[0].nodes[0]; const h1 = result.root.nodes[0].nodes[0];
const h2 = result.root.nodes[1].nodes[0].nodes[0]; const h2 = result.root.nodes[1].nodes[0].nodes[0];
expect(sameParent(h1, h2)).not.toBe(true); expect(sameParent(h1, h2)).not.toBe(true);
}); });
}); });
 End of changes. 10 change blocks. 
10 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)