css-chain-test
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"main": "index.js", | ||
@@ -22,3 +22,3 @@ "module": "index.js", | ||
"dependencies": { | ||
"css-chain": "^1.0.6", | ||
"css-chain": "^1.0.7", | ||
"lit": "^2.0.0" | ||
@@ -25,0 +25,0 @@ }, |
@@ -9,3 +9,3 @@ # CssChain & ApiChain test and \<css-chain> demo | ||
## Live demo | ||
https://unpkg.com/css-chain-test@1.0.6/dist/demo.html | ||
https://unpkg.com/css-chain-test@1.0.7/dist/demo.html | ||
@@ -69,3 +69,3 @@ # [CssChain](https://github.com/sashafirsov/css-chain/blob/main/CssChain.js) | ||
``` | ||
# [ApiChain.js](./ApiChain.js) | ||
# [ApiChain.js](https://github.com/sashafirsov/css-chain/blob/main/ApiChain.js) | ||
## Array of raw objects | ||
@@ -109,3 +109,7 @@ ```js | ||
``` | ||
# Samples of use | ||
PokéAPI Explorer: | ||
[![PokéAPI Explorer][PokeApi-explorer-image]][PokeApi-explorer-url] | ||
## Testing with Web Test Runner | ||
@@ -156,3 +160,5 @@ | ||
[npm-url]: https://npmjs.org/package/css-chain-test | ||
[coverage-image]: https://unpkg.com/css-chain-test@1.0.6/coverage/coverage.svg | ||
[coverage-url]: https://unpkg.com/css-chain-test@1.0.6/coverage/lcov-report/index.html | ||
[coverage-image]: https://unpkg.com/css-chain-test@1.0.7/coverage/coverage.svg | ||
[coverage-url]: https://unpkg.com/css-chain-test@1.0.7/coverage/lcov-report/index.html | ||
[PokeApi-explorer-image]: https://unpkg.com/css-chain-test@1.0.7/src/PokeApi-Explorer.png | ||
[PokeApi-explorer-url]: https://unpkg.com/css-chain-test@1.0.7/src/PokeApi-Explorer.html |
@@ -1,2 +0,2 @@ | ||
import $ from '../src/CssChain.js'; | ||
import $ from './CssChain.js'; | ||
@@ -3,0 +3,0 @@ export class |
@@ -180,3 +180,116 @@ import { fixture, expect } from '@open-wc/testing'; | ||
} ); | ||
it( 'get innerText', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
expect( $$('a',el).innerText.trim() ).to.equal('a1a2'); | ||
expect( $$(el).innerText.replace(/\n/g,'') ).to.equal('da1a2D'); | ||
} ); | ||
it( 'set innerText', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
$$('a',el).innerText = 'b'; | ||
expect( $$('a',el).innerText ).to.equal('bb'); | ||
expect( $$(el).innerText.replace(/\n/g,'') ).to.equal('dbbD'); | ||
} ); | ||
it( 'get innerHTML', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
expect( $$('a',el).innerHTML).to.include('a1'); | ||
expect( $$('a',el).innerHTML).to.include('a2'); | ||
expect( $$('a',el).innerHTML).to.include('<hr'); | ||
expect( $$('a',el).innerHTML).to.include('<br'); | ||
expect( $$(el).innerHTML ).to.equal('d<a>a1<hr></a><a>a2<br></a>D'); | ||
} ); | ||
it( 'set innerHTML', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
$$('a',el).innerHTML = 'B' | ||
expect( $$('a',el).innerText).to.include('BB'); | ||
$$('a',el).innerHTML = '<b>A</b>'; | ||
expect( $$('b',el).length ).to.equal(2); | ||
expect( $$('b',el).innerText.replace(/\n/g,'') ).to.equal('AA'); | ||
} ); | ||
it( 'cloneNode()', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
let $X = $$('a',el).cloneNode(); // shallow - only 1st tags are cloned | ||
expect( $X.length ).to.eq(2); | ||
expect( $X.tagName ).to.eq('A'); | ||
expect( $X.innerHTML ).to.not.include('hr'); | ||
expect( $X.innerHTML ).to.not.include('a1'); | ||
expect( $X.innerHTML ).to.not.include('a2'); | ||
} ); | ||
const testCloned = $X => | ||
{ | ||
expect( $X.length ).to.eq(2); | ||
expect( $X.tagName.toLowerCase() ).to.eq('a'); | ||
expect( $X[0].innerHTML ).to.include('a1'); | ||
expect( $X[1].innerHTML ).to.include('a2'); | ||
expect( $X[0].innerHTML ).to.include('<hr'); | ||
expect( $X[1].innerHTML ).to.include('<br'); | ||
return $X; | ||
}; | ||
it( 'cloneNode(true)', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
let $X = $$('a',el).cloneNode(true); | ||
testCloned( $X ); | ||
} ); | ||
it( 'clone()', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
testCloned( $$('a',el ).clone() ); | ||
} ); | ||
it( 'clone(doc)', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
const doc = new Document(); | ||
const $X = $$('a',el ); | ||
const $Y = testCloned( $X.clone(doc) ); | ||
expect( $Y.ownerDocument ).to.eq(doc); | ||
expect( $X.ownerDocument ).to.eq(document); | ||
expect( $Y.ownerDocument ).to.eq(doc); | ||
} ); | ||
it( 'append(str)', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
const doc = new Document(); | ||
const $X = $$('a',el ); | ||
const $Y = $X.append( '<b>B1</b>' ); | ||
expect( $X ).to.eq($Y); | ||
expect( $X.innerHTML ).to.eq("a1<hr><b>B1</b>a2<br><b>B1</b>"); | ||
} ); | ||
it( 'append( str[] )', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1<hr/></a><a>a2<br/></a>D</div>`); | ||
const doc = new Document(); | ||
const $X = $$('a',el ); | ||
const $Y = $X.append( ['<b>B1</b>','<i>I1</i>'] ); | ||
expect( $X ).to.eq($Y); | ||
expect( $X.innerHTML ).to.eq("a1<hr><b>B1</b><i>I1</i>a2<br><b>B1</b><i>I1</i>"); | ||
} ); | ||
it( 'append( el[] )', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1</a><a>a2</a>D</div>`); | ||
const doc = new Document(); | ||
const $X = $$('a',el ); | ||
const $Y = $X.append( [document.createElement('hr'),document.createElement('br')] ); | ||
expect( $X ).to.eq($Y); | ||
expect( $X.innerHTML ).to.eq("a1a2<hr><br>"); | ||
} ); | ||
it( 'clear()', async ()=> | ||
{ | ||
const el = await fixture(html`<div>d<a>a1</a><a>a2</a>D</div>`); | ||
const doc = new Document(); | ||
const $X = $$('a',el ); | ||
const $Y = $X.clear(); | ||
expect( $X ).to.eq($Y); | ||
expect( $X.innerHTML ).to.eq(""); | ||
const $Z= $$(el); | ||
$Z.clear(); | ||
expect( $Z.innerHTML ).to.eq(""); | ||
expect( $Z.outerHTML ).to.eq("<div></div>"); | ||
} ); | ||
} ); |
@@ -22,3 +22,3 @@ import { fixture, expect } from '@open-wc/testing'; | ||
expect( $X.find( ()=>1) ).to.equal(undefined); | ||
expect( $X.innerHTML ).to.equal(undefined); // dom element prop | ||
expect( $X.innerHTML ).to.equal(''); // dom element prop | ||
expect( $X.value ).to.equal(undefined); // INPUT prop | ||
@@ -57,3 +57,3 @@ }; | ||
$X.innerText = 'B'; | ||
expect( $X.innerHTML ).to.equal(undefined); | ||
expect( $X.innerHTML ).to.equal(''); | ||
} ); | ||
@@ -66,5 +66,4 @@ it( '[2] setter', async ()=> | ||
expect( $X[0].innerHTML ).to.equal('B'); | ||
expect( $X .innerHTML ).to.equal('B'); | ||
expect( $X[1].innerHTML ).to.equal('B'); | ||
expect( $X .innerHTML ).to.equal('B'); | ||
expect( $X .innerHTML ).to.equal('BB'); | ||
} ); | ||
@@ -71,0 +70,0 @@ it( 'chaining', async ()=> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302891
55
1838
161
3
Updatedcss-chain@^1.0.7