dox Executable Documentation

Attributes

False and null leaf attributes should be removed

Given the model '{"name": {"title":false, "class":null}}'
When I render '<div property="name" title="test" class="nothing"></div>'
Then the result should be '<div property="name"></div>'

Leaf attributes should be replaced

Given the model '{"image": {"src":"http://example.com", "alt":"Test"}}'
When I render '<img property="image" src="" alt="nothing"/>'
Then the result should be '<img property="image" src="http://example.com" alt="Test"/>'

Child with name of attribute

Given the model '{"item": {"title": "Hello"}}'
When I render '<span property="item" title=""><span property="title"></span></span>'
Then the result should be '<span property="item" title="Hello"><span property="title">Hello</span></span>'

Attribute scope

Given the model '{"title": "None", "message": {"text": "Hello World"} }'
When I render '<span property="message" title="Dont change me"><span property="text">Hi</span></span>'
Then the result should be '<span property="message" title="Dont change me"><span property="text">Hello World</span></span>'

Special content attribute

Given the model '{"item": {"title": "Hello", "_":"World"}}'
When I render '<span property="item" title="What">Up</span>'
Then the result should be '<span property="item" title="Hello">World</span>'