dox Executable Documentation

Repeating elements

List of values

Given the model '{ "item": [ "One", "Two" ] }'
When I render '<span property="item">an item</span>'
Then the result should be '<span property="item">One</span><span property="item">Two</span>'

List of nested values

Given the model '{ "item": [ { "name": "Uno", "title": "One" }, { "name": "Dos", "title": "Two" } ] }'
When I render ' <div property="item"> <span property="title">my title</span> <span property="name">my name</span> </div>'
Then the result should be ' <div property="item"> <span property="title">One</span> <span property="name">Uno</span> </div> <div property="item"> <span property="title">Two</span> <span property="name">Dos</span> </div>'

Superfluous sibling

Given the model '{ "item": [ "One", "Two" ] }'
When I render ' <span property="item">an item</span> <span property="item">delete me</span> <span property="item">delete me too</span>'
Then the result should be ' <span property="item">One</span> <span property="item">Two</span>'

Double list

Given the model '{ "item": [[ "One", "Two" ]] }'
When I render ' <span property="item">an item</span> <span property="item">delete me</span> <span property="item">delete me too</span>'
Then the result should be ' <span property="item">One</span> <span property="item">Two</span>'

Supefluous siblings of nested model

Given the model '{ "item": [ { "name": "Uno" }, { "name": "Dos" } ] }'
When I render ' <div property="item"> <span property="name">my name</span> </div> <div property="item"> <span property="name">delete me</span> </div> <div property="item"> <span property="name">me too</span> </div>'
Then the result should be ' <div property="item"> <span property="name">Uno</span> </div> <div property="item"> <span property="name">Dos</span> </div>'

Remove inner element from item

Given the model '{ "item": [ { "name": "One", "call": true }, { "name": "Two", "call": false } ] }'
When I render ' <div property="item"> <span property="name">Name</span> <span property="call">!!</span> </div> '
Then the result should be ' <div property="item"> <span property="name">One</span> <span property="call">!!</span> </div> <div property="item"> <span property="name">Two</span> </div> '

Empty list

Given the model '{"item": []}'
When I render ' <ul> <li property="item"> <span property="name">Name</span> <span property="call">!!</span> </li> </ul> '
Then the result should be ' <ul></ul> '

List of lists

Given the model '{ "week": [ { "count" : 1, "day": [ { "number": 1 }, { "number": 2 }, { "number": 3 } ] }, { "count" : 2, "day": [ { "number": 4 }, { "number": 5 }, { "number": 6 } ] } ] }'
When I render ' <div property="week"> <div property="count">count</div> <div property="day"> <span property="number">#</span> </div> </div> <div property="week"> <div property="day"> <span property="number">should be deleted</span> </div> </div> '
Then the result should be ' <div property="week"> <div property="count">1</div> <div property="day"> <span property="number">1</span> </div> <div property="day"> <span property="number">2</span> </div> <div property="day"> <span property="number">3</span> </div> </div> <div property="week"> <div property="count">2</div> <div property="day"> <span property="number">4</span> </div> <div property="day"> <span property="number">5</span> </div> <div property="day"> <span property="number">6</span> </div> </div> '

List objects

Given the model object array('item' => new Liste(array('one', 'two')))
When I render '<span property="item">an item</span>'
Then the result should be '<span property="item">one</span><span property="item">two</span>'