lit-html
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -272,2 +272,7 @@ /** | ||
// up any residual nodes from a previously longer iterable. | ||
const range = document.createRange(); | ||
range.setStartBefore(itemPart.endNode); | ||
range.setEndBefore(this.endNode); | ||
range.deleteContents(); | ||
range.detach(); | ||
itemPart.endNode = this.endNode; | ||
@@ -274,0 +279,0 @@ } |
@@ -64,2 +64,13 @@ /** | ||
}); | ||
test('updates when called multiple times with arrays', () => { | ||
const container = document.createElement('div'); | ||
const ul = (list) => { | ||
var items = list.map(item => html `<li>${item}</li>`); | ||
return html `<ul>${items}</ul>`; | ||
}; | ||
ul(['a', 'b', 'c']).renderTo(container); | ||
assert.equal(container.innerHTML, '<ul><li>a</li><li>b</li><li>c</li></ul>'); | ||
ul(['x', 'y']).renderTo(container); | ||
assert.equal(container.innerHTML, '<ul><li>x</li><li>y</li></ul>'); | ||
}); | ||
}); | ||
@@ -450,3 +461,3 @@ suite('TemplateResult', () => { | ||
}); | ||
test('updates when called multiple times with arrays', () => { | ||
test('updates when called multiple times with arrays 2', () => { | ||
part.setValue([1, 2, 3]); | ||
@@ -453,0 +464,0 @@ assert.equal(container.innerHTML, '123'); |
{ | ||
"name": "lit-html", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "HTML template literals in JavaScript", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
@@ -260,3 +260,2 @@ /** | ||
setValue(value: any): void { | ||
let node: Node|undefined = undefined; | ||
@@ -312,2 +311,7 @@ value = this._getValue(value); | ||
// up any residual nodes from a previously longer iterable. | ||
const range = document.createRange(); | ||
range.setStartBefore(itemPart.endNode); | ||
range.setEndBefore(this.endNode); | ||
range.deleteContents(); | ||
range.detach(); | ||
itemPart.endNode = this.endNode; | ||
@@ -314,0 +318,0 @@ } |
@@ -74,4 +74,16 @@ /** | ||
assert.equal(instance._parts.length, 2); | ||
}) | ||
}); | ||
test('updates when called multiple times with arrays', () => { | ||
const container = document.createElement('div'); | ||
const ul = (list: string[]) => { | ||
var items = list.map(item => html`<li>${item}</li>`); | ||
return html`<ul>${items}</ul>`; | ||
}; | ||
ul(['a', 'b', 'c']).renderTo(container); | ||
assert.equal(container.innerHTML, '<ul><li>a</li><li>b</li><li>c</li></ul>'); | ||
ul(['x', 'y']).renderTo(container); | ||
assert.equal(container.innerHTML, '<ul><li>x</li><li>y</li></ul>'); | ||
}); | ||
}); | ||
@@ -544,3 +556,3 @@ | ||
test('updates when called multiple times with arrays', () => { | ||
test('updates when called multiple times with arrays 2', () => { | ||
part.setValue([1, 2, 3]); | ||
@@ -547,0 +559,0 @@ assert.equal(container.innerHTML, '123'); |
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
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
181754
2538