Tom Alexander
e54e20d254
Add a test case for casting booleans to numbers.
2020-06-14 18:14:27 -04:00
Tom Alexander
5dff03bb37
Add a test case for type casting to the equality helper tests.
2020-06-14 16:20:07 -04:00
Tom Alexander
648ae5dfdb
Turns out I was wrong, the @size helper attempts to cast to a number regardless of the input and it uses that. Fixed the test.
2020-06-14 15:20:54 -04:00
Tom Alexander
e70f397545
First attempt at fixing by reading all indirect references containing a reference to a single value as the original value is a failure. Turns out the @size helper treats numeric types in indirect references differently.
2020-06-14 14:51:31 -04:00
Tom Alexander
716a110d2e
Added some notes about observed behavior and fixed return types for missing/absent keys.
2020-06-14 14:13:33 -04:00
Tom Alexander
1a54e35736
Add tests and a Sizable trait for ContextElement.
2020-06-14 12:54:03 -04:00
Tom Alexander
978bbe6eb3
Implemented float literals for OwnedLiterals, not yet for serde_json.
2020-06-13 13:37:26 -04:00
Tom Alexander
8daa746da6
Initial structure for the perform_math_operation function.
2020-06-13 13:16:25 -04:00
Tom Alexander
c5db1cea8f
Add a test case for the math helper and add else blocks to the select test.
2020-06-13 11:45:45 -04:00
Tom Alexander
0fac063c8d
Implemented none and any, but I need to implement early termination.
2020-06-07 18:52:09 -04:00
Tom Alexander
a61807d84c
Add parser support for select/any/none.
2020-06-07 17:06:14 -04:00
Tom Alexander
84c07b262c
Add a test for the select helper.
2020-06-07 16:50:11 -04:00
Tom Alexander
417466d17d
Implement the first and last helpers.
2020-06-07 15:16:39 -04:00
Tom Alexander
fdecdcb53b
Implemented the sep helper.
2020-06-07 15:09:37 -04:00
Tom Alexander
3ef2facc92
Expanding the sep helpers test.
2020-06-07 14:07:32 -04:00
Tom Alexander
bb658284e6
Add a test for the sep helper.
2020-06-07 14:01:58 -04:00
Tom Alexander
865cba6f4e
Add a test proving that renamed variables are still equal, so its not just based on path.
2020-06-07 01:15:45 -04:00
Tom Alexander
4dee230780
Add some test cases for comparing equality on reference parameters.
2020-06-07 01:11:40 -04:00
Tom Alexander
917da5a073
Put IntoContextElement everywhere. It compiles again.
2020-05-30 17:50:27 -04:00
Tom Alexander
3352b777ae
Factor out the parsing of partial template names into its own parser for reuse as an rvalue.
2020-05-30 15:45:44 -04:00
Tom Alexander
4932a4bb6f
Add tests for reference parameters.
2020-05-30 15:20:54 -04:00
Tom Alexander
e7c05f597f
Add a test proving exists does not support parameters.
2020-05-30 14:42:34 -04:00
Tom Alexander
eb0eb8d4ca
Add priority tests for the other block types except helpers since I do not yet have a helper implemented that sets a value.
2020-05-30 13:47:13 -04:00
Tom Alexander
f04e84dc31
Attempted to move section over to the section-specific new breadcrumbs function.
...
I think the problem is, the index context needs to be a higher priority than the new context element, but when referencing data with `{.}` the new context element needs to take priority. I could either combine entries in the context tree so that variables like $idx and $len live side-by-side with real context elements, or try to implement a way to skip over index context elements when walking up the tree.
2020-05-25 23:28:49 -04:00
Tom Alexander
79f52ecdee
Add test for priorities while looping and split the new_breadcrumbs function into two separate new_breadcrumbs functions because sections and partials have different orderings.
2020-05-25 22:50:10 -04:00
Tom Alexander
0ca17e0885
Add tests that prove that the priority between explicit contexts and parameters varies across sections and partials.
2020-05-25 20:23:10 -04:00
Tom Alexander
5b1e3c5fb0
Had to sort the input to the explicit_context_setting test because dustjs leaves the original order but serde_json sorts the keys.
2020-05-25 19:30:30 -04:00
Tom Alexander
25eb9b10a0
I did it backwards, I needed to use the explicit context from the block, not the inline partial.
2020-05-25 19:24:49 -04:00
Tom Alexander
400602124e
Added tests proving that the explicit context is evaluated using the global context of the partial containing the block (NOT the inline partial, which is where the explicit context is written).
2020-05-25 17:53:04 -04:00
Tom Alexander
4ce0899279
Expand the explicit context setting test to prove that injected_context gets inserted AFTER the current context when an explicit context is used.
2020-05-25 16:21:25 -04:00
Tom Alexander
4a21ae5af3
Add tests for explicit context setting that check failure conditions and implement a helper function to generate a new breadcrumb stack.
2020-05-25 15:40:42 -04:00
Tom Alexander
1152ff9974
Greatly expand the explicit_context_setting test.
...
Turns out explicit context setting works in a lot more places than the official dustjs pages indicate. Also some things don't make much sense (like setting it on a block works but not on an inline partial).
2020-05-24 18:16:16 -04:00
Tom Alexander
e27ab16e06
Add a test for explicit context setting.
2020-05-24 17:19:34 -04:00
Tom Alexander
e0fe7475c5
Add a single element array test for idx_and_len.
...
This test is mostly because I am currently turning truthy values into single element arrays during render, so I need to make sure idx and len and not being set for non-array iteration.
2020-05-24 15:29:14 -04:00
Tom Alexander
9925802ae9
Add .$idx to nested section test.
2020-05-24 15:25:17 -04:00
Tom Alexander
93adaa518d
Add a test for $idx and $len inside nested sections.
2020-05-24 15:22:12 -04:00
Tom Alexander
abf251c68d
Add a test for $idx and $len.
2020-05-24 15:22:10 -04:00
Tom Alexander
1ad9753845
Add an ignored test for type casting.
...
I think in order to support type casting in a generic fashion so that custom non-json types can be used, I'll need to push the implementation of helpers off into the traits instead of handling it in the renderer. This is a larger undertaking than I was planning on starting at this very moment, so I'm going to leave this test disabled and move on to a couple smaller tasks I wanted to knock out before starting implementation on custom helpers.
2020-05-24 13:05:34 -04:00
Tom Alexander
533ea96d4f
Add a test for literal string blocks.
2020-05-23 23:32:13 -04:00
Tom Alexander
6e8c7621f1
It seems paths with a leading dot restrict the scope the below the current context.
2020-05-23 23:06:04 -04:00
Tom Alexander
da4ef1a8c8
Remove the headers to the dust helper tests because they were misleading.
2020-05-23 22:41:12 -04:00
Tom Alexander
96e8dd63a7
Dustjs appears to have an output limit of 65536 characters which was breaking the string test, so I split it in two.
2020-05-23 22:23:54 -04:00
Tom Alexander
71378ed37d
Fix a bug w.r.t. quoting and escaping boolean values with filters.
2020-05-23 19:34:38 -04:00
Tom Alexander
bd7866e973
Implement encodeURIComponent filter.
2020-05-23 19:10:02 -04:00
Tom Alexander
46d4f50410
Implement the encodeURI filter.
2020-05-23 19:06:09 -04:00
Tom Alexander
8d2728a767
Implement javascript string escaping.
2020-05-23 18:40:09 -04:00
Tom Alexander
f3fef17d4b
I was wrong, html escape filter is appended even if an html escape filter is already there.
2020-05-23 18:18:59 -04:00
Tom Alexander
e22bffd2ba
Implemented the json stringify and parse filters.
2020-05-23 18:14:23 -04:00
Tom Alexander
624c83b680
Automatically appending the html escape filter on the renderer side.
2020-05-23 17:57:19 -04:00
Tom Alexander
6a9fe9e1be
Beginning of applying filters for json types. Currently only supports html escaping.
2020-05-23 17:23:48 -04:00