Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(948)

Side by Side Diff: pkg/mustache/test/spec/sections.json

Issue 804973002: Add appengine/gcloud/mustache dependencies. (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Added AUTHORS/LICENSE/PATENTS files Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/mustache/test/spec/partials.yml ('k') | pkg/mustache/test/spec/sections.yml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 {"__ATTN__":"Do not edit this file; changes belong in the appropriate YAML file. ","overview":"Section tags and End Section tags are used in combination to wrap a section\nof the template for iteration\n\nThese tags' content MUST be a non-wh itespace character sequence NOT\ncontaining the current closing delimiter; each Section tag MUST be followed\nby an End Section tag with the same content within the same section.\n\nThis tag's content names the data to replace the tag. Nam e resolution is as\nfollows:\n 1) Split the name on periods; the first part is the name to resolve, any\n remaining parts should be retained.\n 2) Walk the c ontext stack from top to bottom, finding the first context\n that is a) a hash containing the name as a key OR b) an object responding\n to a method with the given name.\n 3) If the context is a hash, the data is the value associated wit h the\n name.\n 4) If the context is an object and the method with the given n ame has an\n arity of 1, the method SHOULD be called with a String containing t he\n unprocessed contents of the sections; the data is the value returned.\n 5 ) Otherwise, the data is the value returned by calling the method with\n the gi ven name.\n 6) If any name parts were retained in step 1, each should be resolv ed\n against a context stack containing only the result from the former\n reso lution. If any part fails resolution, the result should be considered\n falsey , and should interpolate as the empty string.\nIf the data is not of a list type , it is coerced into a list as follows: if\nthe data is truthy (e.g. `!!data == true`), use a single-element list\ncontaining the data, otherwise use an empty l ist.\n\nFor each element in the data list, the element MUST be pushed onto the\n context stack, the section MUST be rendered, and the element MUST be popped\noff the context stack.\n\nSection and End Section tags SHOULD be treated as standal one when\nappropriate.\n","tests":[{"name":"Truthy","data":{"boolean":true},"exp ected":"\"This should be rendered.\"","template":"\"{{#boolean}}This should be r endered.{{/boolean}}\"","desc":"Truthy sections should have their contents rende red."},{"name":"Falsey","data":{"boolean":false},"expected":"\"\"","template":"\ "{{#boolean}}This should not be rendered.{{/boolean}}\"","desc":"Falsey sections should have their contents omitted."},{"name":"Context","data":{"context":{"nam e":"Joe"}},"expected":"\"Hi Joe.\"","template":"\"{{#context}}Hi {{name}}.{{/con text}}\"","desc":"Objects and hashes should be pushed onto the context stack."}, {"name":"Deeply Nested Contexts","data":{"a":{"one":1},"b":{"two":2},"c":{"three ":3},"d":{"four":4},"e":{"five":5}},"expected":"1\n121\n12321\n1234321\n12345432 1\n1234321\n12321\n121\n1\n","template":"{{#a}}\n{{one}}\n{{#b}}\n{{one}}{{two}} {{one}}\n{{#c}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{#d}}\n{{one}}{{two}}{{ three}}{{four}}{{three}}{{two}}{{one}}\n{{#e}}\n{{one}}{{two}}{{three}}{{four}}{ {five}}{{four}}{{three}}{{two}}{{one}}\n{{/e}}\n{{one}}{{two}}{{three}}{{four}}{ {three}}{{two}}{{one}}\n{{/d}}\n{{one}}{{two}}{{three}}{{two}}{{one}}\n{{/c}}\n{ {one}}{{two}}{{one}}\n{{/b}}\n{{one}}\n{{/a}}\n","desc":"All elements on the con text stack should be accessible."},{"name":"List","data":{"list":[{"item":1},{"i tem":2},{"item":3}]},"expected":"\"123\"","template":"\"{{#list}}{{item}}{{/list }}\"","desc":"Lists should be iterated; list items should visit the context stac k."},{"name":"Empty List","data":{"list":[]},"expected":"\"\"","template":"\"{{# list}}Yay lists!{{/list}}\"","desc":"Empty lists should behave like falsey value s."},{"name":"Doubled","data":{"two":"second","bool":true},"expected":"* first\n * second\n* third\n","template":"{{#bool}}\n* first\n{{/bool}}\n* {{two}}\n{{#bo ol}}\n* third\n{{/bool}}\n","desc":"Multiple sections per template should be per mitted."},{"name":"Nested (Truthy)","data":{"bool":true},"expected":"| A B C D E |","template":"| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |","desc":"Neste d truthy sections should have their contents rendered."},{"name":"Nested (Falsey )","data":{"bool":false},"expected":"| A E |","template":"| A {{#bool}}B {{#boo l}}C{{/bool}} D{{/bool}} E |","desc":"Nested falsey sections should be omitted." },{"name":"Context Misses","data":{},"expected":"[]","template":"[{{#missing}}Fo und key 'missing'!{{/missing}}]","desc":"Failed context lookups should be consid ered falsey."},{"name":"Implicit Iterator - String","data":{"list":["a","b","c", "d","e"]},"expected":"\"(a)(b)(c)(d)(e)\"","template":"\"{{#list}}({{.}}){{/list }}\"","desc":"Implicit iterators should directly interpolate strings."},{"name": "Implicit Iterator - Integer","data":{"list":[1,2,3,4,5]},"expected":"\"(1)(2)(3 )(4)(5)\"","template":"\"{{#list}}({{.}}){{/list}}\"","desc":"Implicit iterators should cast integers to strings and interpolate."},{"name":"Implicit Iterator - Decimal","data":{"list":[1.1,2.2,3.3,4.4,5.5]},"expected":"\"(1.1)(2.2)(3.3)(4. 4)(5.5)\"","template":"\"{{#list}}({{.}}){{/list}}\"","desc":"Implicit iterators should cast decimals to strings and interpolate."},{"name":"Dotted Names - Trut hy","data":{"a":{"b":{"c":true}}},"expected":"\"Here\" == \"Here\"","template":" \"{{#a.b.c}}Here{{/a.b.c}}\" == \"Here\"","desc":"Dotted names should be valid f or Section tags."},{"name":"Dotted Names - Falsey","data":{"a":{"b":{"c":false}} },"expected":"\"\" == \"\"","template":"\"{{#a.b.c}}Here{{/a.b.c}}\" == \"\"","d esc":"Dotted names should be valid for Section tags."},{"name":"Dotted Names - B roken Chains","data":{"a":{}},"expected":"\"\" == \"\"","template":"\"{{#a.b.c}} Here{{/a.b.c}}\" == \"\"","desc":"Dotted names that cannot be resolved should be considered falsey."},{"name":"Surrounding Whitespace","data":{"boolean":true}," expected":" | \t|\t | \n","template":" | {{#boolean}}\t|\t{{/boolean}} | \n","de sc":"Sections should not alter surrounding whitespace."},{"name":"Internal White space","data":{"boolean":true},"expected":" | \n | \n","template":" | {{#boole an}} {{! Important Whitespace }}\n {{/boolean}} | \n","desc":"Sections should no t alter internal whitespace."},{"name":"Indented Inline Sections","data":{"boole an":true},"expected":" YES\n GOOD\n","template":" {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n","desc":"Single-line sections should not alter su rrounding whitespace."},{"name":"Standalone Lines","data":{"boolean":true},"expe cted":"| This Is\n|\n| A Line\n","template":"| This Is\n{{#boolean}}\n|\n{{/bool ean}}\n| A Line\n","desc":"Standalone lines should be removed from the template. "},{"name":"Indented Standalone Lines","data":{"boolean":true},"expected":"| Thi s Is\n|\n| A Line\n","template":"| This Is\n {{#boolean}}\n|\n {{/boolean}}\n| A Line\n","desc":"Indented standalone lines should be removed from the template ."},{"name":"Standalone Line Endings","data":{"boolean":true},"expected":"|\r\n| ","template":"|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|","desc":"\"\\r\\n\" should be considered a newline for standalone tags."},{"name":"Standalone Without Previ ous Line","data":{"boolean":true},"expected":"#\n/","template":" {{#boolean}}\n #{{/boolean}}\n/","desc":"Standalone tags should not require a newline to preced e them."},{"name":"Standalone Without Newline","data":{"boolean":true},"expected ":"#\n/\n","template":"#{{#boolean}}\n/\n {{/boolean}}","desc":"Standalone tags should not require a newline to follow them."},{"name":"Padding","data":{"boole an":true},"expected":"|=|","template":"|{{# boolean }}={{/ boolean }}|","desc":" Superfluous in-tag whitespace should be ignored."}]}
OLDNEW
« no previous file with comments | « pkg/mustache/test/spec/partials.yml ('k') | pkg/mustache/test/spec/sections.yml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698