diff --git a/benchmark/merge.js b/benchmark/merge.js index 27f6efb..66a3a12 100644 --- a/benchmark/merge.js +++ b/benchmark/merge.js @@ -7,18 +7,18 @@ const decls = { [{ block: 'block-2' }] ], blockMods: [ - [{ block: 'block', modName: 'bool-mod', modVal: true }], - [{ block: 'block', modName: 'mod', modVal: 'val-1' }], - [{ block: 'block', modName: 'mod', modVal: 'val-2' }] + [{ block: 'block', mod: { name: 'bool-mod', val: true } }], + [{ block: 'block', mod: { name: 'mod', val: 'val-1' } }], + [{ block: 'block', mod: { name: 'mod', val: 'val-2' } }] ], elems: [ [{ block: 'block', elem: 'elem-1' }], [{ block: 'block', elem: 'elem-2' }] ], elemMods: [ - [{ block: 'block', elem: 'elem' , modName: 'bool-mod', modVal: true }], - [{ block: 'block', elem: 'elem' , modName: 'mod', modVal: 'val-1' }], - [{ block: 'block', elem: 'elem' , modName: 'mod', modVal: 'val-2' }] + [{ block: 'block', elem: 'elem' , mod: { name: 'bool-mod', val: true } }], + [{ block: 'block', elem: 'elem' , mod: { name: 'mod', val: 'val-1' } }], + [{ block: 'block', elem: 'elem' , mod: { name: 'mod', val: 'val-2' } }] ] }; diff --git a/benchmark/normalize-harmony.js b/benchmark/normalize-harmony.js index 7fa96c3..0ad62f3 100644 --- a/benchmark/normalize-harmony.js +++ b/benchmark/normalize-harmony.js @@ -12,9 +12,9 @@ const decls = { { block: 'block-3' } ], blockMods: [ - { block: 'block-1', modName: 'mod' }, - { block: 'block-2', modName: 'mod', modVal: true }, - { block: 'block-3', modName: 'mod', modVal: 'val' }, + { block: 'block-1', mod: { name: 'mod' }, + { block: 'block-2', mod: { name: 'mod', val: true } }, + { block: 'block-3', mod: { name: 'mod', val: 'val' } }, { block: 'block-4', mods: { mod: 'val' } }, { block: 'block-5', mods: ['mod-1', 'mod-2'] }, { block: 'block-6', mods: { mod: ['val-1', 'val-2'] } } @@ -24,9 +24,9 @@ const decls = { { block: 'block', elems: ['elem-1', 'elem-2'] } ], elemMods: [ - { block: 'block-1', elem: 'elem', modName: 'mod' }, - { block: 'block-2', elem: 'elem', modName: 'mod', modVal: true }, - { block: 'block-3', elem: 'elem', modName: 'mod', modVal: 'val' }, + { block: 'block-1', elem: 'elem', mod: { name: 'mod' }, + { block: 'block-2', elem: 'elem', mod: { name: 'mod', val: true } }, + { block: 'block-3', elem: 'elem', mod: { name: 'mod', val: 'val' } }, { block: 'block-4', elem: 'elem', mods: { mod: 'val' } }, { block: 'block-5', elem: 'elem', mods: ['mod-1', 'mod-2'] }, { block: 'block-6', elem: 'elem', mods: { mod: ['val-1', 'val-2'] } } diff --git a/test/assign.test.js b/test/assign.test.js index f180fdd..07f2408 100644 --- a/test/assign.test.js +++ b/test/assign.test.js @@ -21,7 +21,7 @@ test('entity block should correcly assign with block-elem from scope', t => { test('entity block should correcly assign with block-mod from scope', t => { t.deepEqual(simplifyCell(assign( { entity: { block: 'b' } }, - { entity: { block: 'sb', modName: 'sm', modVal: 'sv' } })), + { entity: { block: 'sb', mod: { name: 'sm', val: 'sv' } } })), { entity: { block: 'b' }, tech: null }); }); @@ -32,59 +32,59 @@ test('entity elem should dominate scope’s one', t => { { entity: { block: 'b', elem: 'e' }, tech: null }); }); -test('entity modName should dominate scope’s one for block', t => { +test('entity mod.name should dominate scope’s one for block', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: 'b', modName: 'm' } }, - { entity: { block: 'sb', modName: 'sm' } })), - { entity: { block: 'b', modName: 'm', modVal: true }, tech: null }); + { entity: { block: 'b', mod: { name: 'm' } } }, + { entity: { block: 'sb', mod: { name: 'sm' } } })), + { entity: { block: 'b', mod: { name: 'm', val: true } }, tech: null }); }); -test('entity modVal should dominate scope’s one for block', t => { +test('entity mod.val should dominate scope’s one for block', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: 'b', modName: 'm', modVal: 'v' } }, - { entity: { block: 'sb', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'b', modName: 'm', modVal: 'v' }, tech: null }); + { entity: { block: 'b', mod: { name: 'm', val: 'v' } } }, + { entity: { block: 'sb', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'b', mod: { name: 'm', val: 'v' } }, tech: null }); }); test('entity elem should NOT be filled with scope elem for block', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: 'b', modName: 'm', modVal: 'v' } }, + { entity: { block: 'b', mod: { name: 'm', val: 'v' } } }, { entity: { block: 'sb', elem: 'se' } })), - { entity: { block: 'b', modName: 'm', modVal: 'v' }, tech: null }); + { entity: { block: 'b', mod: { name: 'm', val: 'v' } }, tech: null }); }); -test('entity modName should dominate scope’s one for block and elem', t => { +test('entity mod.name should dominate scope’s one for block and elem', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: 'b', elem: 'e', modName: 'm' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm' } })), - { entity: { block: 'b', elem: 'e', modName: 'm', modVal: true }, tech: null }); + { entity: { block: 'b', elem: 'e', mod: { name: 'm' } } }, + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm' } } })), + { entity: { block: 'b', elem: 'e', mod: { name: 'm', val: true } }, tech: null }); }); -test('entity modVal should dominate scope’s one for block and elem', t => { +test('entity mod.val should dominate scope’s one for block and elem', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: 'b', elem: 'e', modName: 'm', modVal: 'v' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'b', elem: 'e', modName: 'm', modVal: 'v' }, tech: null }); + { entity: { block: 'b', elem: 'e', mod: { name: 'm', val: 'v' } } }, + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'b', elem: 'e', mod: { name: 'm', val: 'v' } }, tech: null }); }); -test('entity with block should not be filled with scope\'s modName/modVal', t => { +test('entity with block should not be filled with scope\'s mod.name/modVal', t => { t.deepEqual(simplifyCell(assign( { entity: { block: 'b' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' } })), + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } } })), { entity: { block: 'b' }, tech: null }); }); -test('entity with block and elem should not be filled with scope\'s modName/modVal', t => { +test('entity with block and elem should not be filled with scope\'s mod.name/modVal', t => { t.deepEqual(simplifyCell(assign( { entity: { block: 'b', elem: 'e' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' } })), + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } } })), { entity: { block: 'b', elem: 'e' }, tech: null }); }); test('entity with elem should be filled with block only', t => { t.deepEqual(simplifyCell(assign( { entity: { elem: 'e' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' } })), + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } } })), { entity: { block: 'sb', elem: 'e' }, tech: null }); }); @@ -95,76 +95,76 @@ test('entity elem should use scope’s block', t => { { entity: { block: 'sb', elem: 'e' }, tech: null }); }); -test('entity modName should use scope’s block', t => { +test('entity mod.name should use scope’s block', t => { t.deepEqual(simplifyCell(assign( - { entity: { modName: 'm' } }, - { entity: { block: 'sb', modName: 'sm' } })), - { entity: { block: 'sb', modName: 'm', modVal: true }, tech: null }); + { entity: { mod: { name: 'm' } } }, + { entity: { block: 'sb', mod: { name: 'sm' } } })), + { entity: { block: 'sb', mod: { name: 'm', val: true } }, tech: null }); }); -test('entity modName should use scope’s elem', t => { +test('entity mod.name should use scope’s elem', t => { t.deepEqual(simplifyCell(assign( - { entity: { modName: 'm' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm' } })), - { entity: { block: 'sb', elem: 'se', modName: 'm', modVal: true }, tech: null }); + { entity: { mod: { name: 'm' } } }, + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm' } } })), + { entity: { block: 'sb', elem: 'se', mod: { name: 'm', val: true } }, tech: null }); }); -test('entity modVal should use scope’s block and modName', t => { +test('entity mod.val should use scope’s block and mod.name', t => { t.deepEqual(simplifyCell(assign( - { entity: { modVal: 'v' } }, - { entity: { block: 'sb', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'sb', modName: 'sm', modVal: 'v' }, tech: null }); + { entity: { mod: { val: 'v' } } }, + { entity: { block: 'sb', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'sb', mod: { name: 'sm', val: 'v' } }, tech: null }); }); -test('entity modVal should use scope’s block, elem and modName', t => { +test('entity mod.val should use scope’s block, elem and mod.name', t => { t.deepEqual(simplifyCell(assign( - { entity: { modVal: 'v' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'v' }, tech: null }); + { entity: { mod: { val: 'v' } } }, + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'v' } }, tech: null }); }); test('should assign entity for mod and val for block', t => { t.deepEqual(simplifyCell(assign( - { entity: { modName: 'm', modVal: 'v' } }, + { entity: { mod: { name: 'm', val: 'v' } } }, { entity: { block: 'sb' } })), - { entity: { block: 'sb', modName: 'm', modVal: 'v' }, tech: null }); + { entity: { block: 'sb', mod: { name: 'm', val: 'v' } }, tech: null }); }); test('should assign entity for mod and val for block and elem', t => { t.deepEqual(simplifyCell(assign( - { entity: { modName: 'm', modVal: 'v' } }, + { entity: { mod: { name: 'm', val: 'v' } } }, { entity: { block: 'sb', elem: 'se' } })), - { entity: { block: 'sb', elem: 'se', modName: 'm', modVal: 'v' }, tech: null }); + { entity: { block: 'sb', elem: 'se', mod: { name: 'm', val: 'v' } }, tech: null }); }); -test('should cut modName and modVal from scope for elem', t => { +test('should cut mod.name and mod.val from scope for elem', t => { t.deepEqual(simplifyCell(assign( { entity: { elem: 'e' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' } })), + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } } })), { entity: { block: 'sb', elem: 'e' }, tech: null }); }); -test('should cut modVal from scope for modName', t => { +test('should cut mod.val from scope for mod.name', t => { t.deepEqual(simplifyCell(assign( - { entity: { modName: 'm' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'sb', elem: 'se', modName: 'm', modVal: true }, tech: null }); + { entity: { mod: { name: 'm' } } }, + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'sb', elem: 'se', mod: { name: 'm', val: true } }, tech: null }); }); -test('should use only block from scope for elem and modName', t => { +test('should use only block from scope for elem and mod.name', t => { t.deepEqual(simplifyCell(assign( - { entity: { elem: 'e', modName: 'm' } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'sb', elem: 'e', modName: 'm', modVal: true }, tech: null }); + { entity: { elem: 'e', mod: { name: 'm' } } }, + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'sb', elem: 'e', mod: { name: 'm', val: true } }, tech: null }); }); // Edge cases test('should allow 0 as mod value', t => { t.deepEqual(simplifyCell(assign( - { entity: { modVal: 0 } }, - { entity: { block: 'sb', modName: 'sm' } })), - { entity: { block: 'sb', modName: 'sm', modVal: 0 }, tech: null }); + { entity: { mod: { val: 0 } } }, + { entity: { block: 'sb', mod: { name: 'sm' } } })), + { entity: { block: 'sb', mod: { name: 'sm', val: 0 } }, tech: null }); }); test('should use block for nothing', t => { @@ -184,63 +184,63 @@ test('should throw on empty without scope', t => { test('should use scope with block if entity has empty fields', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: undefined, elem: undefined, modName: undefined, modVal: undefined } }, + { entity: { block: undefined, elem: undefined, mod: { name: undefined, val: undefined } } }, { entity: { block: 'sb' } })), { entity: { block: 'sb' }, tech: null }); }); test('should use scope with block and boolean modifier if entity has empty fields', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: undefined, elem: undefined, modName: undefined, modVal: undefined } }, - { entity: { block: 'sb', modName: 'sm', modVal: true } })), - { entity: { block: 'sb', modName: 'sm', modVal: true }, tech: null }); + { entity: { block: undefined, elem: undefined, mod: { name: undefined, val: undefined } } }, + { entity: { block: 'sb', mod: { name: 'sm', val: true } } })), + { entity: { block: 'sb', mod: { name: 'sm', val: true } }, tech: null }); }); test('should use scope with block and modifier if entity has empty fields', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: undefined, elem: undefined, modName: undefined, modVal: undefined } }, - { entity: { block: 'sb', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'sb', modName: 'sm', modVal: 'sv' }, tech: null }); + { entity: { block: undefined, elem: undefined, mod: { name: undefined, val: undefined } } }, + { entity: { block: 'sb', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'sb', mod: { name: 'sm', val: 'sv' } }, tech: null }); }); test('should use scope with elem if entity has empty fields', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: undefined, elem: undefined, modName: undefined, modVal: undefined } }, + { entity: { block: undefined, elem: undefined, mod: { name: undefined, val: undefined } } }, { entity: { block: 'sb', elem: 'se' } })), { entity: { block: 'sb', elem: 'se' }, tech: null }); }); test('should use scope with elem and boolean modifier if entity has empty fields', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: undefined, elem: undefined, modName: undefined, modVal: undefined } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: true } })), - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: true }, tech: null }); + { entity: { block: undefined, elem: undefined, mod: { name: undefined, val: undefined } } }, + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: true } } })), + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: true } }, tech: null }); }); test('should use scope with elem and modifier if entity has empty fields', t => { t.deepEqual(simplifyCell(assign( - { entity: { block: undefined, elem: undefined, modName: undefined, modVal: undefined } }, - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'sb', elem: 'se', modName: 'sm', modVal: 'sv' }, tech: null }); + { entity: { block: undefined, elem: undefined, mod: { name: undefined, val: undefined } } }, + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'sb', elem: 'se', mod: { name: 'sm', val: 'sv' } }, tech: null }); }); -test('should use modVal from scope if nothing given', t => { +test('should use mod.val from scope if nothing given', t => { t.deepEqual(simplifyCell(assign( { }, - { entity: { block: 'sb', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'sb', modName: 'sm', modVal: 'sv' }, tech: null }); + { entity: { block: 'sb', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'sb', mod: { name: 'sm', val: 'sv' } }, tech: null }); }); -test('should not use modVal from scope if only block given', t => { +test('should not use mod.val from scope if only block given', t => { t.deepEqual(simplifyCell(assign( - { entity: { modVal: 'sv' } }, + { entity: { mod: { val: 'sv' } } }, { entity: { block: 'sb' } })), { entity: { block: 'sb' }, tech: null }); }); -test('should not use modVal from scope if only elem given', t => { +test('should not use mod.val from scope if only elem given', t => { t.deepEqual(simplifyCell(assign( - { entity: { modVal: 'sv' } }, + { entity: { mod: { val: 'sv' } } }, { entity: { block: 'sb', elem: 'se' } })), { entity: { block: 'sb', elem: 'se' }, tech: null }); }); @@ -268,20 +268,20 @@ test('should merge with scope if only tech given', t => { { entity: { block: 'sb', elem: 'se' }, tech: 'bemhtml' }); }); -test('should use modVal with scope if only tech given', t => { +test('should use mod.val with scope if only tech given', t => { t.deepEqual(simplifyCell(assign( { tech: 'bemhtml' }, - { entity: { block: 'sb', modName: 'sm', modVal: 'sv' } })), - { entity: { block: 'sb', modName: 'sm', modVal: 'sv' }, tech: 'bemhtml' }); + { entity: { block: 'sb', mod: { name: 'sm', val: 'sv' } } })), + { entity: { block: 'sb', mod: { name: 'sm', val: 'sv' } }, tech: 'bemhtml' }); }); test('should use scope vals if null given', t => { t.deepEqual( simplifyCell(assign( - { entity: { block: null, modName: 'mod', modVal: 'val' } }, + { entity: { block: null, mod: { name: 'mod', val: 'val' } } }, { entity: { block: 'block', elem: 'elem' }, tech: 'bemhtml' } )), - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: 'bemhtml' } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: 'bemhtml' } ) }); diff --git a/test/format/enb.test.js b/test/format/enb.test.js index 193b1e6..f8a13af 100644 --- a/test/format/enb.test.js +++ b/test/format/enb.test.js @@ -28,7 +28,7 @@ test('should coformatnvert with elem', t => { test('should format with mod', t => { t.deepEqual( format([ - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null } ], { format: 'enb' }), [{ block: 'block', mod: 'mod', val: 'val' }] ) diff --git a/test/intersect/disjoint-entities.test.js b/test/intersect/disjoint-entities.test.js index 6226582..f3c3142 100644 --- a/test/intersect/disjoint-entities.test.js +++ b/test/intersect/disjoint-entities.test.js @@ -8,37 +8,37 @@ const intersect = require('../../lib/intersect'); test('should not intersect other entities from block', t => { const decl1 = [{ entity: { block: 'block' }, tech: null }].map(createCell); const decl2 = [ - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ].map(createCell); t.deepEqual(intersect(decl1, decl2), []); }); test('should not intersect other entities from bool mod', t => { - const decl1 = [{ entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }].map(createCell); + const decl1 = [{ entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }].map(createCell); const decl2 = [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ].map(createCell); t.deepEqual(intersect(decl1, decl2), []); }); test('should not intersect other entities from mod', t => { - const decl1 = [{ entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null }].map(createCell); + const decl1 = [{ entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null }].map(createCell); const decl2 = [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ].map(createCell); t.deepEqual(intersect(decl1, decl2), []); @@ -48,10 +48,10 @@ test('should not intersect other entities from elem', t => { const decl1 = [{ entity: { block: 'block', elem: 'elem' }, tech: null }].map(createCell); const decl2 = [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null }, ].map(createCell); t.deepEqual(intersect(decl1, decl2), []); @@ -59,14 +59,14 @@ test('should not intersect other entities from elem', t => { test('should not intersect other entities from bool mod of elem', t => { const decl1 = [ - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null } ].map(createCell); const decl2 = [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ].map(createCell); t.deepEqual(intersect(decl1, decl2), []); @@ -74,14 +74,14 @@ test('should not intersect other entities from bool mod of elem', t => { test('should not intersect other entities from mod of elem', t => { const decl1 = [ - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ].map(createCell); const decl2 = [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null } ].map(createCell); t.deepEqual(intersect(decl1, decl2), []); diff --git a/test/intersect/intersecting-entities.test.js b/test/intersect/intersecting-entities.test.js index 3d32bbe..b12948e 100644 --- a/test/intersect/intersecting-entities.test.js +++ b/test/intersect/intersecting-entities.test.js @@ -11,13 +11,13 @@ test('should intersect block with block', t => { }); test('should intersect bool mod with bool mod', t => { - const mod = [{ entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }].map(createCell); + const mod = [{ entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }].map(createCell); t.deepEqual(intersect(mod, mod), mod); }); test('should intersect mod with mod', t => { - const mod = [{ entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null }].map(createCell); + const mod = [{ entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null }].map(createCell); t.deepEqual(intersect(mod, mod), mod); }); @@ -30,7 +30,7 @@ test('should intersect elem with elem', t => { test('should intersect bool mod of elem with bool mod of elem', t => { const mod = [ - { entity: { block: 'block', elem: 'elem' , modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem' , mod: { name: 'mod', val: true } }, tech: null } ].map(createCell); t.deepEqual(intersect(mod, mod), mod); @@ -38,7 +38,7 @@ test('should intersect bool mod of elem with bool mod of elem', t => { test('should intersect elem mod with elem mod', t => { const mod = [ - { entity: { block: 'block', elem: 'elem' , modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem' , mod: { name: 'mod', val: 'val' } }, tech: null } ].map(createCell); t.deepEqual(intersect(mod, mod), mod); diff --git a/test/merge/bem.test.js b/test/merge/bem.test.js index c2c7978..3460559 100644 --- a/test/merge/bem.test.js +++ b/test/merge/bem.test.js @@ -19,14 +19,14 @@ test('should merge block with its elem', t => { test('should merge block with its mod', t => { const block = [{ entity: { block: 'block' } }].map(createCell); - const mod = [{ entity: { block: 'block', modName: 'mod', modVal: 'val' } }].map(createCell); + const mod = [{ entity: { block: 'block', mod: { name: 'mod', val: 'val' } } }].map(createCell); t.deepEqual(merge(block, mod), [].concat(block, mod)); }); test('should merge block with its bool mod', t => { const block = [{ entity: { block: 'block' } }].map(createCell); - const mod = [{ entity: { block: 'block', modName: 'mod', modVal: true } }].map(createCell); + const mod = [{ entity: { block: 'block', mod: { 'mod', val: true } } }].map(createCell); t.deepEqual(merge(block, mod), [].concat(block, mod)); }); @@ -39,36 +39,36 @@ test('should merge elems of block', t => { }); test('should merge mods of block', t => { - const mod1 = [{ entity: { block: 'block', modName: 'mod-1', modVal: true } }].map(createCell); - const mod2 = [{ entity: { block: 'block', modName: 'mod-2', modVal: true } }].map(createCell); + const mod1 = [{ entity: { block: 'block', mod: { name: 'mod-1', val: true } } }].map(createCell); + const mod2 = [{ entity: { block: 'block', mod: { name: 'mod-2', val: true } } }].map(createCell); t.deepEqual(merge(mod1, mod2), [].concat(mod1, mod2)); }); test('should merge mod vals of block mod', t => { - const val1 = [{ entity: { block: 'block', modName: 'mod', modVal: 'val-1' } }].map(createCell); - const val2 = [{ entity: { block: 'block', modName: 'mod', modVal: 'val-2' } }].map(createCell); + const val1 = [{ entity: { block: 'block', mod: { name: 'mod', val: 'val-1' } } }].map(createCell); + const val2 = [{ entity: { block: 'block', mod: { name: 'mod', val: 'val-2' } } }].map(createCell); t.deepEqual(merge(val1, val2), [].concat(val1, val2)); }); test('should merge elem with its mod', t => { const elem = [{ entity: { block: 'block', elem: 'elem' } }].map(createCell); - const mod = [{ entity: { block: 'block', elem: 'elem' , modName: 'mod', modVal: 'val' } }].map(createCell); + const mod = [{ entity: { block: 'block', elem: 'elem' , mod: { name: 'mod', val: 'val' } } }].map(createCell); t.deepEqual(merge(elem, mod), [].concat(elem, mod)); }); test('should merge elem with its bool mod', t => { const elem = [{ entity: { block: 'block', elem: 'elem' } }].map(createCell); - const mod = [{ entity: { block: 'block', elem: 'elem' , modName: 'mod', modVal: true } }].map(createCell); + const mod = [{ entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } } }].map(createCell); t.deepEqual(merge(elem, mod), [].concat(elem, mod)); }); test('should merge mods of elem', t => { - const mod1 = [{ entity: { block: 'block', elem: 'elem', modName: 'mod-1', modVal: true } }].map(createCell); - const mod2 = [{ entity: { block: 'block', elem: 'elem', modName: 'mod-2', modVal: true } }].map(createCell); + const mod1 = [{ entity: { block: 'block', elem: 'elem', mod: { name: 'mod-1', val: true } } }].map(createCell); + const mod2 = [{ entity: { block: 'block', elem: 'elem', mod: { name: 'mod-2', val: true } } }].map(createCell); t.deepEqual(merge(mod1, mod2), [].concat(mod1, mod2)); }); diff --git a/test/normalize-harmony/elem.test.js b/test/normalize-harmony/elem.test.js index 2e9226f..56caeb0 100644 --- a/test/normalize-harmony/elem.test.js +++ b/test/normalize-harmony/elem.test.js @@ -19,27 +19,27 @@ test('should support shortcut for bool mod of elem', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null } ]); }); test('should support bool mod of elem', t => { - const decl = { block: 'block', elem: 'elem', modName: 'mod', modVal: true }; + const decl = { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }; t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null } ]); }); test('should support elem mod', t => { - const decl = { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }; + const decl = { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }; t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -53,7 +53,7 @@ test('should support elem mods as object', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -67,8 +67,8 @@ test('should support bool mods of elem as array', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod-1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod-2', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod-1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod-2', val: true } }, tech: null } ]); }); @@ -82,7 +82,7 @@ test('should support mod values of elem as array', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val-1' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val-2' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val-1' } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val-2' } }, tech: null } ]); }); diff --git a/test/normalize-harmony/elems.test.js b/test/normalize-harmony/elems.test.js index aafcbd6..10af99c 100644 --- a/test/normalize-harmony/elems.test.js +++ b/test/normalize-harmony/elems.test.js @@ -38,6 +38,6 @@ test('should support mods for elem objects', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); diff --git a/test/normalize-harmony/mix.test.js b/test/normalize-harmony/mix.test.js index 37f4612..66b1c91 100644 --- a/test/normalize-harmony/mix.test.js +++ b/test/normalize-harmony/mix.test.js @@ -15,7 +15,7 @@ test('should support mix', t => { { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem-1' }, tech: null }, { entity: { block: 'block', elem: 'elem-2' }, tech: null }, - { entity: { block: 'block', modName: 'mod-1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'mod-2', modVal: true }, tech: null } + { entity: { block: 'block', mod: { name: 'mod-1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod-2', val: true } }, tech: null } ]); }); diff --git a/test/normalize-harmony/mods.test.js b/test/normalize-harmony/mods.test.js index e34179f..a9b3ec7 100644 --- a/test/normalize-harmony/mods.test.js +++ b/test/normalize-harmony/mods.test.js @@ -9,25 +9,25 @@ test('should support shortcut for bool mod', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null } ]); }); test('should support bool mod', t => { - const decl = { block: 'block', modName: 'mod', modVal: true }; + const decl = { block: 'block', mod: { name: 'mod', val: true } }; t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null } ]); }); test('should support mod', t => { - const decl = { block: 'block', modName: 'mod', modVal: 'val' }; + const decl = { block: 'block', mod: { name: 'mod', val: 'val' } }; t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -39,7 +39,7 @@ test('should support mods as objects', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -51,8 +51,8 @@ test('should support bool mods as array', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod-1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'mod-2', modVal: true }, tech: null } + { entity: { block: 'block', mod: { name: 'mod-1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod-2', val: true } }, tech: null } ]); }); @@ -64,7 +64,7 @@ test('should support mod values as array', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val-1' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val-2' }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: 'val-1' } }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val-2' } }, tech: null } ]); }); diff --git a/test/normalize-harmony/scope.test.js b/test/normalize-harmony/scope.test.js index 69d2040..a146cc7 100644 --- a/test/normalize-harmony/scope.test.js +++ b/test/normalize-harmony/scope.test.js @@ -12,7 +12,7 @@ test('should support mod in block scope', t => { }; t.deepEqual(normalize(decl).map(simplifyCell), [ - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -23,7 +23,7 @@ test('should support mods in block scope', t => { }; t.deepEqual(normalize(decl).map(simplifyCell), [ - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -53,23 +53,23 @@ test('should support elems in block scope', t => { test('should support elem mod in block scope', t => { const decl = { scope: 'block', - elem: 'elem', modName: 'mod', modVal: 'val' + elem: 'elem', mod: { name: 'mod', val: 'val' } }; t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); test('should support mod in elem scope', t => { const decl = { scope: { block: 'block', elem: 'elem' }, - modName: 'mod', modVal: 'val' + mod: { name: 'mod', val: 'val' } }; t.deepEqual(normalize(decl).map(simplifyCell), [ - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -83,7 +83,7 @@ test('should support mix in elem scope', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem-1' }, tech: null }, { entity: { block: 'block', elem: 'elem-2' }, tech: null }, - { entity: { block: 'block', modName: 'mod-1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'mod-2', modVal: true }, tech: null } + { entity: { block: 'block', mod: { name: 'mod-1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod-2', val: true } }, tech: null } ]); }); diff --git a/test/normalize/elems.test.js b/test/normalize/elems.test.js index 930782e..bf8be2a 100644 --- a/test/normalize/elems.test.js +++ b/test/normalize/elems.test.js @@ -31,7 +31,7 @@ test('should support objects', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -46,6 +46,6 @@ test('should support mod shortcut', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null } ]); }); diff --git a/test/normalize/mods.test.js b/test/normalize/mods.test.js index 862ac70..a54ffac 100644 --- a/test/normalize/mods.test.js +++ b/test/normalize/mods.test.js @@ -9,7 +9,7 @@ test('should support objects', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -21,8 +21,8 @@ test('should support several items', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod-1', modVal: 'val' }, tech: null }, - { entity: { block: 'block', modName: 'mod-2', modVal: 'val' }, tech: null } + { entity: { block: 'block', mod: { name: 'mod-1', val: 'val' } }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod-2', val: 'val' } }, tech: null } ]); }); @@ -31,6 +31,6 @@ test('should support mod shortcut', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null } ]); }); diff --git a/test/normalize2/block-mod.test.js b/test/normalize2/block-mod.test.js index da33016..8c7d8f4 100644 --- a/test/normalize2/block-mod.test.js +++ b/test/normalize2/block-mod.test.js @@ -12,8 +12,8 @@ test('should support mod', t => { } t.deepEqual(normalize(decl).map(simplifyCell), [ - { entity: { block: 'block', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm1', val: 'v1' } }, tech: null } ]); }); @@ -26,7 +26,7 @@ test('should support mod with tech', t => { } t.deepEqual(normalize(decl).map(simplifyCell), [ - { entity: { block: 'block', modName: 'm1', modVal: true }, tech: 'js' }, - { entity: { block: 'block', modName: 'm1', modVal: 'v1' }, tech: 'js' } + { entity: { block: 'block', mod: { name: 'm1', val: true } }, tech: 'js' }, + { entity: { block: 'block', mod: { name: 'm1', val: 'v1' } }, tech: 'js' } ]); }); diff --git a/test/normalize2/block-mods.test.js b/test/normalize2/block-mods.test.js index ec29172..ab22161 100644 --- a/test/normalize2/block-mods.test.js +++ b/test/normalize2/block-mods.test.js @@ -14,8 +14,8 @@ test('sould support mods', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm1', val: 'v1' } }, tech: null } ]); }); @@ -30,8 +30,8 @@ test('should pass mods to elem', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'm1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'm1', val: 'v1' } }, tech: null } ]); }); @@ -46,10 +46,10 @@ test('should support several mods', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: 'v1' }, tech: null }, - { entity: { block: 'block', modName: 'm2', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'm2', modVal: 'v2' }, tech: null } + { entity: { block: 'block', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm1', val: 'v1' } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm2', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm2', val: 'v2' } }, tech: null } ]); }); @@ -63,9 +63,9 @@ test('should support array of mod values in object', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: 'v1' }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: 'v2' }, tech: null } + { entity: { block: 'block', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm1', val: 'v1' } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm1', val: 'v2' } }, tech: null } ]); }); @@ -77,7 +77,7 @@ test('should support array of mod values', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'm2', modVal: true }, tech: null } + { entity: { block: 'block', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm2', val: true } }, tech: null } ]); }); diff --git a/test/normalize2/elem-mod.test.js b/test/normalize2/elem-mod.test.js index acc9fb7..e2273e7 100644 --- a/test/normalize2/elem-mod.test.js +++ b/test/normalize2/elem-mod.test.js @@ -9,7 +9,7 @@ test('should support shortcut for bool mod of elem', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null } ]); }); @@ -18,7 +18,7 @@ test('should support bool mod of elem', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } }, tech: null } ]); }); @@ -32,11 +32,11 @@ test('should support elem array mod', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem1' }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'm1', modVal: 'v1' }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'm1', val: 'v1' } }, tech: null }, { entity: { block: 'block', elem: 'elem2' }, tech: null }, - { entity: { block: 'block', elem: 'elem2', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem2', modName: 'm1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', elem: 'elem2', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem2', mod: { name: 'm1', val: 'v1' } }, tech: null } ]); }); @@ -52,10 +52,10 @@ test('should support elem of elem as array with mod', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem1' }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'm1', modVal: 'v1' }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'm1', val: 'v1' } }, tech: null }, { entity: { block: 'block', elem: 'elem2' }, tech: null }, - { entity: { block: 'block', elem: 'elem2', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem2', modName: 'm1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', elem: 'elem2', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem2', mod: { name: 'm1', val: 'v1' } }, tech: null } ]); }); diff --git a/test/normalize2/elem-mods.test.js b/test/normalize2/elem-mods.test.js index 1808dbb..5214fc7 100644 --- a/test/normalize2/elem-mods.test.js +++ b/test/normalize2/elem-mods.test.js @@ -17,8 +17,8 @@ test('should support elem as object and mod', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod1', val: 'v1' } }, tech: null } ]); }); test('should support elem of elem as array mods', t => { @@ -36,11 +36,11 @@ test('should support elem of elem as array mods', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem1' }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'm1', modVal: 'v1' }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'm1', val: 'v1' } }, tech: null }, { entity: { block: 'block', elem: 'elem2' }, tech: null }, - { entity: { block: 'block', elem: 'elem2', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem2', modName: 'm1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', elem: 'elem2', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem2', mod: { name: 'm1', val: 'v1' } }, tech: null } ]); }); @@ -53,7 +53,7 @@ test('should support array of mod values', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'm2', modVal: true }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'm2', val: true } }, tech: null } ]); }); diff --git a/test/normalize2/elems-mod.test.js b/test/normalize2/elems-mod.test.js index 2f6f0ed..e0f787b 100644 --- a/test/normalize2/elems-mod.test.js +++ b/test/normalize2/elems-mod.test.js @@ -9,7 +9,7 @@ test('should support shortcut for bool mod of elem', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null } ]); }); @@ -18,7 +18,7 @@ test('should support bool mod of elems', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }, + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null } ]); }); diff --git a/test/normalize2/elems-mods.test.js b/test/normalize2/elems-mods.test.js index ca88b15..3724fea 100644 --- a/test/normalize2/elems-mods.test.js +++ b/test/normalize2/elems-mods.test.js @@ -18,8 +18,8 @@ test('should support elem as object and mod', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'mod1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod1', val: 'v1' } }, tech: null } ]); }); @@ -39,11 +39,11 @@ test('should support elem of elem as array mods', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem1' }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'm1', modVal: 'v1' }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'm1', val: 'v1' } }, tech: null }, { entity: { block: 'block', elem: 'elem2' }, tech: null }, - { entity: { block: 'block', elem: 'elem2', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem2', modName: 'm1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', elem: 'elem2', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem2', mod: { name: 'm1', val: 'v1' } }, tech: null } ]); }); @@ -65,11 +65,11 @@ test('should support mods in elems and block', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: 'v1' }, tech: null }, + { entity: { block: 'block', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm1', val: 'v1' } }, tech: null }, { entity: { block: 'block', elem: 'elem' }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'm2', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem', modName: 'm2', modVal: 'v2' }, tech: null } + { entity: { block: 'block', elem: 'elem', mod: { name: 'm2', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'm2', val: 'v2' } }, tech: null } ]); }); @@ -83,8 +83,8 @@ test('should support block mods with `elems` field without block', t => { t.deepEqual(normalize(decl, { entity: { block: 'sb' } }).map(simplifyCell), [ { entity: { block: 'sb' }, tech: null }, - { entity: { block: 'sb', modName: 'theme', modVal: true }, tech: null }, - { entity: { block: 'sb', modName: 'theme', modVal: 'protect' }, tech: null }, + { entity: { block: 'sb', mod: { name: 'theme', val: true } }, tech: null }, + { entity: { block: 'sb', mod: { name: 'theme', val: 'protect' } }, tech: null }, { entity: { block: 'sb', elem: 'close' }, tech: null } ]); }) diff --git a/test/normalize2/mod-mods-vals.test.js b/test/normalize2/mod-mods-vals.test.js index db221fe..55109eb 100644 --- a/test/normalize2/mod-mods-vals.test.js +++ b/test/normalize2/mod-mods-vals.test.js @@ -13,11 +13,11 @@ test('should support mod and mods with scope block, elem', t => { ]; t.deepEqual(normalize(decl, scope).map(simplifyCell), [ - { entity: { block: 'sb', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'sb', modName: 'mod', modVal: 'val' }, tech: null }, + { entity: { block: 'sb', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'sb', mod: { name: 'mod', val: 'val' } }, tech: null }, { entity: { block: 'sb' }, tech: null }, - { entity: { block: 'sb', modName: 'mod1', modVal: true }, tech: null }, - { entity: { block: 'sb', modName: 'mod1', modVal: 'val1' }, tech: null } + { entity: { block: 'sb', mod: { name: 'mod1', val: true } }, tech: null }, + { entity: { block: 'sb', mod: { name: 'mod1', val: 'val1' } }, tech: null } ]); }); @@ -26,8 +26,8 @@ test('should support mod without block & elem but with scope', t => { const decl = { mod: 'mod', val: 'val' }; t.deepEqual(normalize(decl, scope).map(simplifyCell), [ - { entity: { block: 'sb', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'sb', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'sb', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'sb', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); @@ -37,17 +37,17 @@ test('should support mods without block & elem', t => { t.deepEqual(normalize(decl, scope).map(simplifyCell), [ { entity: { block: 'sb' }, tech: null }, - { entity: { block: 'sb', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'sb', modName: 'mod', modVal: 'val' }, tech: null } + { entity: { block: 'sb', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'sb', mod: { name: 'mod', val: 'val' } }, tech: null } ]); }); test('should support only vals', t => { - const scope = createCell({ entity: { block: 'sb', modName: 'sm' } }); + const scope = createCell({ entity: { block: 'sb', mod: { name: 'sm' } } }); const decl = { val: 'val' }; t.deepEqual(normalize(decl, scope).map(simplifyCell), [ - { entity: { block: 'sb', modName: 'sm', modVal: true }, tech: null }, - { entity: { block: 'sb', modName: 'sm', modVal: 'val' }, tech: null } + { entity: { block: 'sb', mod: { name: 'sm', val: true } }, tech: null }, + { entity: { block: 'sb', mod: { name: 'sm', val: 'val' } }, tech: null } ]); }); diff --git a/test/normalize2/unusual.test.js b/test/normalize2/unusual.test.js index ec57e81..3324085 100644 --- a/test/normalize2/unusual.test.js +++ b/test/normalize2/unusual.test.js @@ -13,9 +13,9 @@ test('should support both mod and mods', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, - { entity: { block: 'block', modName: 'mod', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: true }, tech: null }, - { entity: { block: 'block', modName: 'm1', modVal: 'v1' }, tech: null } + { entity: { block: 'block', mod: { name: 'mod', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm1', val: true } }, tech: null }, + { entity: { block: 'block', mod: { name: 'm1', val: 'v1' } }, tech: null } ]); }); @@ -52,10 +52,10 @@ test('should support both mod, mods, elem and elems :\'(', t => { t.deepEqual(normalize(decl).map(simplifyCell), [ { entity: { block: 'block' }, tech: null }, { entity: { block: 'block', elem: 'elem1' }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'mod1', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'mod1', modVal: 'v1' }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'mod2', modVal: true }, tech: null }, - { entity: { block: 'block', elem: 'elem1', modName: 'mod2', modVal: 'v2' }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'mod1', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'mod1', val: 'v1' } }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'mod2', val: true } }, tech: null }, + { entity: { block: 'block', elem: 'elem1', mod: { name: 'mod2', val: 'v2' } }, tech: null }, { entity: { block: 'block', elem: 'elem2' }, tech: null } ]); }); diff --git a/test/stringify/enb.test.js b/test/stringify/enb.test.js index 53d5566..6654c1d 100644 --- a/test/stringify/enb.test.js +++ b/test/stringify/enb.test.js @@ -10,7 +10,7 @@ test('should stringify enb declaration', t => { const obj = [{ block: 'block', elem: 'elem', mod: 'mod', val: 'val' }]; t.deepEqual( stringify( - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' }, tech: null }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } }, tech: null }, { format: 'enb' } ), 'exports.deps = ' + JSON.stringify(obj, null, 4) + ';\n' diff --git a/test/subtract/disjoint.test.js b/test/subtract/disjoint.test.js index 0b94fdf..5771bf0 100644 --- a/test/subtract/disjoint.test.js +++ b/test/subtract/disjoint.test.js @@ -13,37 +13,37 @@ const subtract = require('../../lib/subtract'); test('should not subtract other entities from block', t => { const decl1 = [{ entity: { block: 'block' } }].map(createCell); const decl2 = [ - { entity: { block: 'block', modName: 'mod', modVal: true } }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' } }, + { entity: { block: 'block', mod: { name: 'mod', val: true } } }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } } }, { entity: { block: 'block', elem: 'elem' } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' } } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } } }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } } } ].map(createCell); t.deepEqual(subtract(decl1, decl2), decl1); }); test('should not subtract other entities from bool mod', t => { - const decl1 = [{ entity: { block: 'block', modName: 'mod', modVal: true } }].map(createCell); + const decl1 = [{ entity: { block: 'block', mod: { name: 'mod', val: true } } }].map(createCell); const decl2 = [ { entity: { block: 'block' } }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' } }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } } }, { entity: { block: 'block', elem: 'elem' } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' } } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } } }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } } } ].map(createCell); t.deepEqual(subtract(decl1, decl2), decl1); }); test('should not subtract other entities from mod', t => { - const decl1 = [{ entity: { block: 'block', modName: 'mod', modVal: 'val' } }].map(createCell); + const decl1 = [{ entity: { block: 'block', mod: { name: 'mod', val: 'val' } } }].map(createCell); const decl2 = [ { entity: { block: 'block' } }, - { entity: { block: 'block', modName: 'mod', modVal: true } }, + { entity: { block: 'block', mod: { name: 'mod', val: true } } }, { entity: { block: 'block', elem: 'elem' } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' } } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } } }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } } } ].map(createCell); t.deepEqual(subtract(decl1, decl2), decl1); @@ -53,36 +53,36 @@ test('should not subtract other entities from elem', t => { const decl1 = [{ entity: { block: 'block', elem: 'elem' } }].map(createCell); const decl2 = [ { entity: { block: 'block' } }, - { entity: { block: 'block', modName: 'mod', modVal: true } }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' } } + { entity: { block: 'block', mod: { name: 'mod', val: true } } }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } } }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } } }, + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } } } ].map(createCell); t.deepEqual(subtract(decl1, decl2), decl1); }); test('should not subtract other entities from bool mod of elem', t => { - const decl1 = [{ entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true } }].map(createCell); + const decl1 = [{ entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } } }].map(createCell); const decl2 = [ { entity: { block: 'block' } }, - { entity: { block: 'block', modName: 'mod', modVal: true } }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' } }, + { entity: { block: 'block', mod: { name: 'mod', val: true } } }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } } }, { entity: { block: 'block', elem: 'elem' } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' } } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } } } ].map(createCell); t.deepEqual(subtract(decl1, decl2), decl1); }); test('should not subtract other entities from mod of elem', t => { - const decl1 = [{ entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: 'val' } }].map(createCell); + const decl1 = [{ entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: 'val' } } }].map(createCell); const decl2 = [ { entity: { block: 'block' } }, - { entity: { block: 'block', modName: 'mod', modVal: true } }, - { entity: { block: 'block', modName: 'mod', modVal: 'val' } }, + { entity: { block: 'block', mod: { name: 'mod', val: true } } }, + { entity: { block: 'block', mod: { name: 'mod', val: 'val' } } }, { entity: { block: 'block', elem: 'elem' } }, - { entity: { block: 'block', elem: 'elem', modName: 'mod', modVal: true } } + { entity: { block: 'block', elem: 'elem', mod: { name: 'mod', val: true } } } ].map(createCell); t.deepEqual(subtract(decl1, decl2), decl1); diff --git a/test/subtract/intersecting.test.js b/test/subtract/intersecting.test.js index bf4940e..7b2a516 100644 --- a/test/subtract/intersecting.test.js +++ b/test/subtract/intersecting.test.js @@ -10,13 +10,13 @@ test('should subtract block from block', t => { }); test('should subtract bool mod from bool mod', t => { - const mod = [{ block: 'block', modName: 'mod', modVal: true }]; + const mod = [{ block: 'block', mod: { name: 'mod', val: true } }]; t.deepEqual(subtract(mod, mod), []); }); test('should subtract mod from mod', t => { - const mod = [{ block: 'block', modName: 'mod', modVal: 'val' }]; + const mod = [{ block: 'block', mod: { name: 'mod', val: 'val' } }]; t.deepEqual(subtract(mod, mod), []); }); @@ -28,13 +28,13 @@ test('should subtract elem from elem', t => { }); test('should subtract bool mod of elem from bool mod of elem', t => { - const mod = [{ block: 'block', elem: 'elem' , modName: 'mod', modVal: true }]; + const mod = [{ block: 'block', elem: 'elem' , mod: { name: 'mod', val: true } }]; t.deepEqual(subtract(mod, mod), []); }); test('should subtract elem mod from elem mod', t => { - const mod = [{ block: 'block', elem: 'elem' , modName: 'mod', modVal: 'val' }]; + const mod = [{ block: 'block', elem: 'elem' , mod: { name: 'mod', val: 'val' } }]; t.deepEqual(subtract(mod, mod), []); });