Skip to content

Commit

Permalink
Change test() to it() in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Q committed Jul 21, 2020
1 parent 14fd91c commit 61cd3e8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe( 'stylisPluginCssCustomProperties', () => {
const createPlugin = () =>
stylisPluginCssCustomProperties( { skipSupportedBrowsers: false } );

test( 'should return undefined if no fallbacks are available', () => {
it( 'should return undefined if no fallbacks are available', () => {
const plugin = createPlugin();
const args = { ...baseArgs };
args.content = 'font-size: 14px';
Expand All @@ -33,7 +33,7 @@ describe( 'stylisPluginCssCustomProperties', () => {
expect( result ).toBe( undefined );
} );

test( 'should return fallback declaration and variablized declaration if var() is used and fallbacks are available', () => {
it( 'should return fallback declaration and variablized declaration if var() is used and fallbacks are available', () => {
const plugin = createPlugin();
const args = { ...baseArgs };

Expand All @@ -51,7 +51,7 @@ describe( 'stylisPluginCssCustomProperties', () => {
expect( result ).toBe( compiled.join( '' ) );
} );

test( 'should handle declarations with parentheses values', () => {
it( 'should handle declarations with parentheses values', () => {
const plugin = createPlugin();
const args = { ...baseArgs };

Expand All @@ -76,7 +76,7 @@ describe( 'stylisPluginCssCustomProperties', () => {
expect( result ).toBe( compiled.join( '' ) );
} );

test( 'should return fallback declarations for every var() call', () => {
it( 'should return fallback declarations for every var() call', () => {
// Set :root variables
document.documentElement.style.setProperty( '--bg', 'black' );
document.documentElement.style.setProperty( '--size', '2' );
Expand Down Expand Up @@ -109,7 +109,7 @@ describe( 'stylisPluginCssCustomProperties', () => {
expect( result ).toBe( compiled.join( '' ) );
} );

test( 'should return if a single fallback was transformed out of many', () => {
it( 'should return if a single fallback was transformed out of many', () => {
const plugin = createPlugin();
const args = { ...baseArgs };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ describe( 'getFallbackDeclaration', () => {
document.documentElement.style = null;
} );
describe( 'invalid', () => {
test( 'should return undefined if it does not contain var()', () => {
it( 'should return undefined if it does not contain var()', () => {
const dec = 'font-size:14px';
const result = getFallbackDeclaration( dec );

expect( result ).toEqual( undefined );
} );

test( 'should return undefined fallback value is non are provided', () => {
it( 'should return undefined fallback value is non are provided', () => {
const dec = 'font-size: var( --fontSize )';
const result = getFallbackDeclaration( dec );

Expand All @@ -31,35 +31,35 @@ describe( 'getFallbackDeclaration', () => {
} );

describe( 'basic', () => {
test( 'should use fallback value if provided', () => {
it( 'should use fallback value if provided', () => {
const dec = 'font-size: var( --fontSize, 14px )';
const result = getFallbackDeclaration( dec );

expect( result ).toEqual( 'font-size:14px' );
} );

test( 'should use fallback value with spaces in-between var()', () => {
it( 'should use fallback value with spaces in-between var()', () => {
const dec = 'font-size: var( --fontSize, 14px )';
const result = getFallbackDeclaration( dec );

expect( result ).toEqual( 'font-size:14px' );
} );

test( 'should use fallback value without spaces in-between var()', () => {
it( 'should use fallback value without spaces in-between var()', () => {
const dec = 'font-size: var(--fontSize,14px)';
const result = getFallbackDeclaration( dec );

expect( result ).toEqual( 'font-size:14px' );
} );

test( 'should use fallback with parentheses value', () => {
it( 'should use fallback with parentheses value', () => {
const dec = 'filter: var(--blur, blur(10px))';
const result = getFallbackDeclaration( dec );

expect( result ).toEqual( 'filter:blur(10px)' );
} );

test( 'should use fallback with nested parentheses value', () => {
it( 'should use fallback with nested parentheses value', () => {
const dec =
'transform:translate3d(var(--x,5px),var(--y,10px),var( --z, 0))';
const result = getFallbackDeclaration( dec );
Expand All @@ -69,30 +69,30 @@ describe( 'getFallbackDeclaration', () => {
} );

describe( 'nested', () => {
test( 'should use nested fallback value if provided', () => {
it( 'should use nested fallback value if provided', () => {
const dec = 'font-size: var( --fontSize, var( --big, 20px ) )';
const result = getFallbackDeclaration( dec );

expect( result ).toEqual( 'font-size:20px' );
} );

test( 'should use heavily nested fallback value if provided', () => {
it( 'should use heavily nested fallback value if provided', () => {
const dec =
'font-size: var( --fontSize, var( --one, var( --two, var( --three, var( --four, 20px )))))';
const result = getFallbackDeclaration( dec );

expect( result ).toEqual( 'font-size:20px' );
} );

test( 'should use heavily nested fallback with space in-between closing parentheses', () => {
it( 'should use heavily nested fallback with space in-between closing parentheses', () => {
const dec =
'font-size: var( --fontSize, var( --one, var( --two, var( --three, var( --four, 20px )) ) ) )';
const result = getFallbackDeclaration( dec );

expect( result ).toEqual( 'font-size:20px' );
} );

test( 'should use heavily nested fallback with parentheses value', () => {
it( 'should use heavily nested fallback with parentheses value', () => {
const dec =
'filter: var( --fontSize, var( --one, var( --two, var( --three, var( --four, blur(20px) )) ) ) )';
const result = getFallbackDeclaration( dec );
Expand All @@ -102,7 +102,7 @@ describe( 'getFallbackDeclaration', () => {
} );

describe( ':root fallback', () => {
test( 'should not use root fallback if one is provided', () => {
it( 'should not use root fallback if one is provided', () => {
document.documentElement.style.setProperty( '--big', '80px' );

const dec = 'font-size: var( --fontSize, 20px )';
Expand All @@ -111,7 +111,7 @@ describe( 'getFallbackDeclaration', () => {
expect( result ).toEqual( 'font-size:20px' );
} );

test( 'should use root fallback if none are provided', () => {
it( 'should use root fallback if none are provided', () => {
document.documentElement.style.setProperty( '--fontSize', '80px' );

const dec = 'font-size: var( --fontSize )';
Expand All @@ -120,7 +120,7 @@ describe( 'getFallbackDeclaration', () => {
expect( result ).toEqual( 'font-size:80px' );
} );

test( 'should use root fallback with nested var()', () => {
it( 'should use root fallback with nested var()', () => {
document.documentElement.style.setProperty( '--big', '80px' );

const dec = 'font-size: var( --fontSize, var( --big ) )';
Expand All @@ -129,7 +129,7 @@ describe( 'getFallbackDeclaration', () => {
expect( result ).toEqual( 'font-size:80px' );
} );

test( 'should use latest root variable', () => {
it( 'should use latest root variable', () => {
document.documentElement.style.setProperty( '--big', '80px' );

let dec = 'font-size: var( --fontSize, var( --big ) )';
Expand Down

0 comments on commit 61cd3e8

Please sign in to comment.