Created
May 4, 2015 17:13
-
-
Save Inviz/cbf6244527a9c6ae045c to your computer and use it in GitHub Desktop.
spec.coffee
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe 'Scaffold', -> | |
| structure = | |
| stack: | |
| 'font-size': {'big','small'} | |
| 'v-align': {'top','bottom'} | |
| group: | |
| 'v-align': {'top','bottom'} | |
| 'h-align': {'left','right'} | |
| 'line-height': ['1md', '2md'] | |
| aside: | |
| 'font-size': {'big','small'} | |
| 'v-align': {'top','bottom'} | |
| it 'should flatten options', -> | |
| expectation = | |
| 'group': | |
| 'inherited': | |
| 'v-align': 'top' | |
| 'h-align': {'left','right'} | |
| 'line-height': '1md' | |
| 'aside': | |
| 'inherited': | |
| 'font-size':{'big','small'} | |
| 'v-align': {'top','bottom'} | |
| 'z-index': '2md' | |
| 'cde': | |
| 'v-align': 'bottom' | |
| 'abc': | |
| 'v-align': 'bottom' | |
| 'aside': | |
| 'inherited': | |
| 'font-size':{'big','small'} | |
| 'v-align': {'top','bottom'} | |
| 'line-height': '3md' | |
| 'cde': | |
| 'v-align': 'bottom' | |
| 'aside': | |
| 'inherited': | |
| 'font-size':{'big','small'} | |
| 'v-align': {'top','bottom'} | |
| 'line-height': '4md' | |
| 'cde': | |
| 'v-align': 'top' | |
| expect(Scaffold(structure)( | |
| group: | |
| 'v-align': 'top' | |
| 'line-height': '1md' | |
| aside: | |
| 'z-index': '2md' | |
| cde: | |
| 'v-align': 'bottom' | |
| abc: | |
| 'v-align': 'bottom' | |
| aside: | |
| 'line-height': '3md' | |
| cde: | |
| 'v-align': 'bottom' | |
| aside: | |
| 'line-height': '4md' | |
| cde: | |
| 'v-align': 'top' | |
| )).to.eql(expectation) | |
| collapsed = | |
| 'group': | |
| 'abc': | |
| 'v-align': 'bottom' | |
| 'h-align': {'left','right'} | |
| 'line-height': '1md' | |
| 'aside': | |
| 'cde': | |
| 'font-size':{'big','small'} | |
| 'v-align': 'bottom' | |
| 'z-index': '2md' | |
| 'line-height': '3md' | |
| 'efg': | |
| 'v-align': 'top' | |
| 'h-align': {'left','right'} | |
| 'line-height': '1md' | |
| 'aside': | |
| 'ghi': | |
| 'font-size':{'big','small'} | |
| 'v-align': {'top','bottom'} | |
| 'line-height': '4md' | |
| expect(Scaffold.reduce(structure, expectation, { | |
| tag: 'layout', | |
| children: [ | |
| { | |
| tag: 'group' | |
| index: 'abc' | |
| children: [ | |
| {tag: 'aside', index: 'cde'} | |
| ] | |
| } | |
| { | |
| tag: 'group' | |
| index: 'efg' | |
| } | |
| {tag: 'aside', index: 'ghi'} | |
| ] | |
| })).to.eql(collapsed) | |
| expect(Scaffold.toString(structure,{ | |
| 'group': | |
| 'abc': | |
| 'v-align': 'bottom' | |
| 'h-align': 'left' | |
| 'line-height': '1md' | |
| 'aside': | |
| 'cde': | |
| 'font-size': 'big' | |
| 'v-align': 'bottom' | |
| 'z-index': '2md' | |
| 'line-height': '3md' | |
| 'efg': | |
| 'v-align': 'top' | |
| 'h-align': 'left' | |
| 'line-height': '1md' | |
| 'aside': | |
| 'ghi': | |
| 'font-size': 'big' | |
| 'v-align': 'top' | |
| 'line-height': '4md' | |
| }, {path: '/a/'})).to.eql """ | |
| .group.abc{ | |
| @import(/a/group/v-align/bottom.gss); | |
| @import(/a/group/h-align/left.gss); | |
| line-height:= 1md; | |
| .aside.cde{ | |
| @import(/a/aside/font-size/big.gss); | |
| @import(/a/aside/v-align/bottom.gss); | |
| z-index:= 2md; | |
| line-height:= 3md; | |
| } | |
| } | |
| .group.efg{ | |
| @import(/a/group/v-align/top.gss); | |
| @import(/a/group/h-align/left.gss); | |
| line-height:= 1md; | |
| } | |
| .aside.ghi{ | |
| @import(/a/aside/font-size/big.gss); | |
| @import(/a/aside/v-align/top.gss); | |
| line-height:= 4md; | |
| } | |
| """ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment