-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sync location-element.test.js , src-attribute.test.js
- Loading branch information
1 parent
d3594fc
commit eb9bd91
Showing
10 changed files
with
427 additions
and
304 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,88 +35,75 @@ | |
description="load the list of pokemons"> | ||
<p>Should display 6 image buttons with pokemon name </p> | ||
<template> | ||
<custom-element tag="dce-1" hidden> | ||
<custom-element> | ||
<template><!-- wrapping into template to prevent images loading within DCE declaration --> | ||
<http-request | ||
url="https://pokeapi.co/api/v2/pokemon?limit=6&offset=0" | ||
slice="page" | ||
method="GET" | ||
header-accept="application/json" | ||
></http-request> | ||
<xsl:variable name="slides-url" | ||
>https://unpkg.com/[email protected]/sprites/pokemon/other/dream-world</xsl:variable> | ||
<xsl:for-each select="//slice/page/data/results/*"> | ||
<xsl:variable name="slides-url" | ||
>https://unpkg.com/[email protected]/sprites/pokemon/other/dream-world</xsl:variable> | ||
<xsl:variable name="pokeid" | ||
select="substring-before( substring-after( @url, 'https://pokeapi.co/api/v2/pokemon/'),'/')" | ||
></xsl:variable> | ||
<button> | ||
<img src="{$slides-url}/{$pokeid}.svg" | ||
alt="{@name}"/> | ||
<xsl:value-of select='@name'/> | ||
{@name} | ||
</button> | ||
</xsl:for-each> | ||
</template> | ||
</custom-element> | ||
<dce-1></dce-1> | ||
</template> | ||
</html-demo-element> | ||
|
||
<html-demo-element legend="1. http-request headers" | ||
<html-demo-element legend="2. http-request response and headers" | ||
description="request and response headers access demo"> | ||
|
||
<template> | ||
<custom-element | ||
tag="headers-demo" | ||
hidden | ||
> | ||
<http-request | ||
url="https://pokeapi.co/api/v2/pokemon?offset=6&limit=6" | ||
slice="request_slice" | ||
type="text" | ||
mode="cors" | ||
header-x-test="testing" | ||
></http-request> | ||
Content of <code>//slice/request_slice</code> is filled by <b>request</b> and <b>response</b> | ||
from <code>${url}</code> | ||
<custom-element url="https://pokeapi.co/api/v2/pokemon?offset=6&limit=6"> | ||
<template> <!-- IMPORTANT! to wrap DCE payload into template to avoid | ||
http-request initializing out of instance --> | ||
<http-request | ||
url="{url}" | ||
slice="request_slice" | ||
type="text" | ||
mode="cors" | ||
header-x-test="testing" | ||
></http-request> | ||
Content of <code>//slice/request_slice</code> is filled by <b>request</b> and <b>response</b> | ||
from <code>${url}</code> | ||
|
||
<h3>Samples</h3> | ||
<table> | ||
<tr><th>//slice/request_slice/request/headers/@mode</th> | ||
<td><xsl:value-of select="//slice/request_slice/request/@mode"/></td></tr> | ||
<tr><th>//slice/request_slice/response/headers/@content-type</th> | ||
<td><xsl:value-of select="//slice/request_slice/response/headers/@content-type"/></td></tr> | ||
<tr><th>//slice/request_slice/response/@status</th> | ||
<td><xsl:value-of select="//slice/request_slice/response/@status"/></td></tr> | ||
</table> | ||
<xsl:for-each select="//slice/request_slice/*"> | ||
<ul data-request-section="{name(.)}"> | ||
<b data-testid="request-section"><xsl:value-of select='name(.)'/></b> | ||
<xsl:for-each select="@*"> | ||
<div> | ||
<var data-testid="section-attribute">@<xsl:value-of select='local-name(.)'/></var> | ||
= | ||
<code><xsl:value-of select='.'/></code> | ||
</div> | ||
</xsl:for-each> | ||
<xsl:for-each select="*"> | ||
<div> | ||
<b data-testid="section-deep"><xsl:value-of select='local-name(.)'/></b> | ||
<ul> | ||
<xsl:for-each select="@*"> | ||
<li> | ||
<var data-testid="section-attribute">@<xsl:value-of select='local-name(.)'/></var> | ||
= | ||
<code><xsl:value-of select='.'/></code> | ||
</li> | ||
</xsl:for-each> | ||
<code><xsl:value-of select='.'/></code> | ||
</ul> | ||
</div> | ||
</xsl:for-each> | ||
</ul> | ||
</xsl:for-each> | ||
</custom-element> | ||
<headers-demo></headers-demo> | ||
<h3>Samples</h3> | ||
<table> | ||
<tr><th> //slice/request_slice/request/@mode </th> | ||
<td>{ //slice/request_slice/request/@mode }</td></tr> | ||
<tr><th> //slice/request_slice/response/headers/@content-type </th> | ||
<td>{ //slice/request_slice/response/headers/@content-type }</td></tr> | ||
<tr><th> //slice/request_slice/response/@status </th> | ||
<td>{ //slice/request_slice/response/@status }</td></tr> | ||
</table> | ||
<xsl:apply-templates mode="display" select="//slice/request_slice/*"></xsl:apply-templates> | ||
<xsl:template mode="display" match="*"> | ||
<fieldset> | ||
<legend> {local-name(.)} </legend> | ||
<ul> | ||
<xsl:for-each select="@*"> | ||
<li> | ||
<var data-testid="section-attribute">@{local-name(.)}</var> | ||
= | ||
<code><xsl:value-of select='.'/></code> | ||
</li> | ||
</xsl:for-each> | ||
</ul> | ||
<xsl:apply-templates mode="display" select="*"></xsl:apply-templates> | ||
</fieldset> | ||
</xsl:template> | ||
</template> | ||
</custom-element> | ||
</template> | ||
</html-demo-element> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.