From 79a4a3d0173d1a7f71f273d22f12160e927247c1 Mon Sep 17 00:00:00 2001 From: Alexey Yaroshevich Date: Sat, 30 Jul 2016 04:11:58 +0300 Subject: [PATCH] Add tests tests: add 2 edge cases for single val specs: add 2 cases without block field --- test/assign.test.js | 14 ++++++++++++++ test/normalize2/elems-mods.test.js | 1 + 2 files changed, 15 insertions(+) diff --git a/test/assign.test.js b/test/assign.test.js index dd11c9f..1cd7fe9 100644 --- a/test/assign.test.js +++ b/test/assign.test.js @@ -138,6 +138,20 @@ test('should use modVal from scope if nothing given', t => { { entity: { block: 'sb', modName: 'sm', modVal: 'sv' }, tech: null }); }); +test('should not use modVal from scope if only block given', t => { + t.deepEqual(assign( + { entity: { modVal: 'sv' } }, + { entity: { block: 'sb' } }), + { entity: { block: 'sb' }, tech: null }); +}); + +test('should not use modVal from scope if only elem given', t => { + t.deepEqual(assign( + { entity: { modVal: 'sv' } }, + { entity: { block: 'sb', elem: 'se' } }), + { entity: { block: 'sb', elem: 'se' }, tech: null }); +}); + // Tech related specs test('assign should support tech grabbing from scope', t => { diff --git a/test/normalize2/elems-mods.test.js b/test/normalize2/elems-mods.test.js index ebe1ed9..197b227 100644 --- a/test/normalize2/elems-mods.test.js +++ b/test/normalize2/elems-mods.test.js @@ -20,6 +20,7 @@ test('should support elem as object and mod', t => { { entity: { block: 'block', elem: 'elem', modName: 'mod1', modVal: 'v1' }, tech: undefined } ]); }); + test('should support elem of elem as array mods', t => { const decl = { block: 'block',