From 01e5771df7249e7f98519a0fd8eb425607a1b001 Mon Sep 17 00:00:00 2001 From: kanalveli R A Date: Wed, 16 Mar 2022 12:52:37 +0530 Subject: [PATCH] [Chore] Modify API Templates --- addon/components/sequential-render.hbs | 4 +- addon/components/sequential-render.js | 12 +- .../components/example-optimized/template.hbs | 24 ++-- tests/dummy/app/templates/docs/usage.md | 12 +- .../components/sequential-render-test.js | 124 +++++++++--------- 5 files changed, 88 insertions(+), 88 deletions(-) diff --git a/addon/components/sequential-render.hbs b/addon/components/sequential-render.hbs index e6757f6..2eca1af 100644 --- a/addon/components/sequential-render.hbs +++ b/addon/components/sequential-render.hbs @@ -1,11 +1,11 @@ {{yield (hash content=this.content isContentLoading=this.isContentLoading - render-content=(component "sequential-render/content" + contentTemplate=(component "sequential-render/content" isFullFilled=this.isFullFilled showFadedState=this.showFadedState ) - loader-state=(component "sequential-render/loader-state" + loaderTemplate=(component "sequential-render/loader-state" isFullFilled=this.isFullFilled ) retry=this.retry diff --git a/addon/components/sequential-render.js b/addon/components/sequential-render.js index d775235..66fe17a 100644 --- a/addon/components/sequential-render.js +++ b/addon/components/sequential-render.js @@ -18,14 +18,14 @@ @getData={{this.executePromise}} @renderCallback={{action 'contentRenderCallback'}} as |renderHash| > - + // Handle loading state if required - - + + // Use renderHash.content to render the content. // Use renderHash.isContentLoading to act based on the data loading state. // Use renderHash.retry action to retrigger data fetch and rendering as applicable. - {{/renderHash.render-content}} + ``` @class sequential-render @@ -33,9 +33,9 @@ @yield {Hash} renderHash @yield {Any} renderHash.content The response from performing getData. @yield {boolean} renderHash.isContentLoading Flag to check the loading state of the data fetch. - @yield {component} renderHash.render-content Block component used to render the content of the item. + @yield {component} renderHash.contentTemplate Block component used to render the content of the item. Accepts loaderClass as an argument. This class can be used to style the subsequent loading states for the item during rerender. - @yield {component} renderHash.loader-state Block component used to render the loading state of the item. + @yield {component} renderHash.loaderTemplate Block component used to render the loading state of the item. @yield {action} renderHash.retry Exposes an action which can be used to retry the data fetch + render process without affecting the queue / app render states.. */ diff --git a/tests/dummy/app/components/example-optimized/template.hbs b/tests/dummy/app/components/example-optimized/template.hbs index b2ee929..09037fc 100644 --- a/tests/dummy/app/components/example-optimized/template.hbs +++ b/tests/dummy/app/components/example-optimized/template.hbs @@ -4,7 +4,7 @@

Dumbledore's Army

- + {{#each @spellWork as |spell|}}
@@ -15,10 +15,10 @@
{{/each}} -
- + +
-
+
@@ -27,7 +27,7 @@ Participants - +
{{#each @participantsList as |person|}}
@@ -35,10 +35,10 @@
{{/each}}
-
- + +
-
+
@@ -47,14 +47,14 @@ Quick Notes - +
{{@notes}}
-
- + +
-
+
diff --git a/tests/dummy/app/templates/docs/usage.md b/tests/dummy/app/templates/docs/usage.md index fdd6ab3..0e54f68 100644 --- a/tests/dummy/app/templates/docs/usage.md +++ b/tests/dummy/app/templates/docs/usage.md @@ -38,12 +38,12 @@ In this example, the critical or hero element is the content inside the left pan ```

Dumbledore's Army

- - + {{#each this.spellWork as |spell|}}
@@ -54,11 +54,11 @@ In this example, the critical or hero element is the content inside the left pan
{{/each}} -
- + + // ...Loader - -
+ +
``` diff --git a/tests/integration/components/sequential-render-test.js b/tests/integration/components/sequential-render-test.js index e1ddde7..8ba66ca 100644 --- a/tests/integration/components/sequential-render-test.js +++ b/tests/integration/components/sequential-render-test.js @@ -50,13 +50,13 @@ module( @renderCallback={{this.afterTask1}} as |seq1| > - +

Render first: {{#unless seq1.isContentLoading}} {{seq1.content.label}} {{/unless}}

-
+ `); @@ -72,12 +72,12 @@ module( @renderCallback={{this.afterTask1}} as |firstComponent| > - +

first

-
- + +

Loading...

-
+ - +

Second

-
- + +

Loading...

-
+
`); assert.verifySteps([AFTER_RENDER.second, AFTER_RENDER.first]); @@ -104,9 +104,9 @@ module( @renderCallback={{this.afterTask1}} as |seq| > - +

Render Second

-
+ - +

Render Second: {{seq1.content.label}}

-
+
- +

Render Second

-
+
`); assert.verifySteps([ @@ -148,9 +148,9 @@ module( @renderCallback={{this.afterTask1}} as |seq| > - +

Render Second

-
+ - +

Render Second

-
+
- +

Render Second

-
+
`); assert.verifySteps([ @@ -189,9 +189,9 @@ module( @renderCallback={{this.afterTask1}} as |seq| > - +

Render Second

-
+ - +

Render Second

-
+
- +

Render Second

-
+
`); assert.verifySteps([ @@ -237,9 +237,9 @@ module( @getData={{this.getDataThrowsError}} as |seq1| > - +

Render Second

-
+ `); }); @@ -251,12 +251,12 @@ module( @taskName="Task1" @renderCallback={{this.afterTask1}} as |SequentialRenderItem| > - +

Render First

-
- + + Loading... - + - +

Render Third

-
- + + Loading... - +
- +

Render First

-
- + + Loading... - +
`); await click('[data-test-id="retry-button"]'); @@ -302,12 +302,12 @@ module( @taskName="Task1" @renderCallback={{this.afterTask1}} as |SequentialRenderItem| > - +

Render First

-
- + + Loading... - + - +

Render Third

- +

Render fourth

-
- +
+ Loading... - +
- +

Render fifth

-
- + + Loading... - +
- - + + Loading... - + - +

Render First

-
- + + Loading... - +
`); assert.verifySteps([