#!/usr/bin/node //--------------------------------------------------------------------- var test = require('ig-test') var parser = require('../parser').parser //--------------------------------------------------------------------- test.Setups({ empty: function(assert){ return [ '', '' ] }, slot_empty: function(assert){ return [ '@slot(slot)', '@slot("slot")', '@slot(\'slot\')', '@slot(name=slot)', '@slot(name="slot")', '@slot(name=\'slot\')', '', '', '', '', '', '', '' ] }, slot_value: function(assert){ return [ '', '', '@slot(slot value)', '@slot(slot text=value)', 'value' ] }, slot_fill: function(assert){ var ins = this.slot_value(assert).slice(0, -1) return [ ...ins.map(function(e){ return e + '@slot(slot other)' }), ...ins.map(function(e){ return e + '' }), ...ins.map(function(e){ return e + 'other' }), 'other' ] }, slot_fill_fill: function(assert){ var ins = this.slot_fill(assert).slice(0, -1) return [ ...ins.map(function(e){ return e + '@slot(slot third)' }), ...ins.map(function(e){ return e + '' }), ...ins.map(function(e){ return e + 'third' }), 'third' ] }, /* XXX CONTENT... slot_content_empty: function(assert){ return [ '@slot(slot body="[[ ]]")', '[[ ]]', '[[ ]]' ] }, slot_content_default: function(assert){ return [ '@slot(slot default body="[[ ]]")', '[[ ]]', '[[ default ]]' ] }, slot_content_fill: function(assert){ var ins = this.slot_content_default(assert) var expect = ins.pop() return [ ...ins.map(function(i){ return i +'@slot(slot value)' }), expect.replace('default', 'value') ] }, //*/ // XXX these are an alternative to ... slot_nested: function(assert){ return [ '[[ ]]@slot(slot.content value)', '[[ value ]]' ] }, slot_nested_overwrite: function(assert){ return [ '[[ ]]@slot(slot value)', 'value' ] }, /* XXX CONTENT... // XXX the question with the next tow is: // should body override or nest? // ...both are logical but in either case the result should be // consistent. // // XXX should the new body/content override or expand the original??? slot_content_content: function(assert){ var ins = this.slot_content_default(assert) var expect = ins.pop() return [ ...ins.map(function(i){ return i +'@slot(slot body="(( @content() ))")' }), // XXX should this override the default above??? //expect.replace('default', '(( default ))') ] }, expect.replace('default', '(( ))') ] }, slot_content_content_content: function(assert){ var ins = this.slot_content_content(assert) var expect = ins.pop() return [ ...ins.map(function(i){ return i +'@slot(slot body="<< @content() >>")' }), // XXX should this override the default above??? //expect.replace('default', '(( default ))') ] }, expect.replace('(( ))', '(( << >> ))') ] }, // XXX if we are expanding (see above) why are we overriding here??? slot_content_content_fill: function(assert){ var ins = this.slot_content_content(assert) var expect = ins.pop() return [ ...ins.map(function(i){ return i +'@slot(slot value)' }), expect.replace('(( ))', '(( value ))') ] }, //expect.replace('(( ))', 'value') ] }, // // XXX these need to be revised... // ...do we actually need hidden/shown??? // slot_shown: function(assert){ var ins = this.slot_value(assert) var expect = ins.pop() return [ ...ins.map(function(i){ return i +' @slot(slot that shown)' }), 'that that' ] }, slot_hidden: function(assert){ return [ '