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

Unified Diff: pkg/mustache/test/spec/partials.yml

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/mustache/test/spec/partials.json ('k') | pkg/mustache/test/spec/sections.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/mustache/test/spec/partials.yml
diff --git a/pkg/mustache/test/spec/partials.yml b/pkg/mustache/test/spec/partials.yml
new file mode 100644
index 0000000000000000000000000000000000000000..8c415439f252ce21b7a07a915982df096255118d
--- /dev/null
+++ b/pkg/mustache/test/spec/partials.yml
@@ -0,0 +1,109 @@
+overview: |
+ Partial tags are used to expand an external template into the current
+ template.
+
+ The tag's content MUST be a non-whitespace character sequence NOT containing
+ the current closing delimiter.
+
+ This tag's content names the partial to inject. Set Delimiter tags MUST NOT
+ affect the parsing of a partial. The partial MUST be rendered against the
+ context stack local to the tag. If the named partial cannot be found, the
+ empty string SHOULD be used instead, as in interpolations.
+
+ Partial tags SHOULD be treated as standalone when appropriate. If this tag
+ is used standalone, any whitespace preceding the tag should treated as
+ indentation, and prepended to each line of the partial before rendering.
+tests:
+ - name: Basic Behavior
+ desc: The greater-than operator should expand to the named partial.
+ data: { }
+ template: '"{{>text}}"'
+ partials: { text: 'from partial' }
+ expected: '"from partial"'
+
+ - name: Failed Lookup
+ desc: The empty string should be used when the named partial is not found.
+ data: { }
+ template: '"{{>text}}"'
+ partials: { }
+ expected: '""'
+
+ - name: Context
+ desc: The greater-than operator should operate within the current context.
+ data: { text: 'content' }
+ template: '"{{>partial}}"'
+ partials: { partial: '*{{text}}*' }
+ expected: '"*content*"'
+
+ - name: Recursion
+ desc: The greater-than operator should properly recurse.
+ data: { content: "X", nodes: [ { content: "Y", nodes: [] } ] }
+ template: '{{>node}}'
+ partials: { node: '{{content}}<{{#nodes}}{{>node}}{{/nodes}}>' }
+ expected: 'X<Y<>>'
+
+ # Whitespace Sensitivity
+
+ - name: Surrounding Whitespace
+ desc: The greater-than operator should not alter surrounding whitespace.
+ data: { }
+ template: '| {{>partial}} |'
+ partials: { partial: "\t|\t" }
+ expected: "| \t|\t |"
+
+ - name: Inline Indentation
+ desc: Whitespace should be left untouched.
+ data: { data: '|' }
+ template: " {{data}} {{> partial}}\n"
+ partials: { partial: ">\n>" }
+ expected: " | >\n>\n"
+
+ - name: Standalone Line Endings
+ desc: '"\r\n" should be considered a newline for standalone tags.'
+ data: { }
+ template: "|\r\n{{>partial}}\r\n|"
+ partials: { partial: ">" }
+ expected: "|\r\n>|"
+
+ - name: Standalone Without Previous Line
+ desc: Standalone tags should not require a newline to precede them.
+ data: { }
+ template: " {{>partial}}\n>"
+ partials: { partial: ">\n>"}
+ expected: " >\n >>"
+
+ - name: Standalone Without Newline
+ desc: Standalone tags should not require a newline to follow them.
+ data: { }
+ template: ">\n {{>partial}}"
+ partials: { partial: ">\n>" }
+ expected: ">\n >\n >"
+
+ - name: Standalone Indentation
+ desc: Each line of the partial should be indented before rendering.
+ data: { content: "<\n->" }
+ template: |
+ \
+ {{>partial}}
+ /
+ partials:
+ partial: |
+ |
+ {{{content}}}
+ |
+ expected: |
+ \
+ |
+ <
+ ->
+ |
+ /
+
+ # Whitespace Insensitivity
+
+ - name: Padding Whitespace
+ desc: Superfluous in-tag whitespace should be ignored.
+ data: { boolean: true }
+ template: "|{{> partial }}|"
+ partials: { partial: "[]" }
+ expected: '|[]|'
« no previous file with comments | « pkg/mustache/test/spec/partials.json ('k') | pkg/mustache/test/spec/sections.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698