Skip to content

Commit

Permalink
fix(engine): closes #871 - support for svg manual injection (#872)
Browse files Browse the repository at this point in the history
* fix(engine): closes #871 - support for svg manual injection

* fix(engine): integration tests
  • Loading branch information
caridy authored Dec 12, 2018
1 parent 3b2f388 commit 4851400
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@lwc/engine/src/faux-shadow/traverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function isNodeSlotted(host: Element, node: Node): boolean {
}
const hostKey = getNodeKey(host);
// just in case the provided node is not an element
let currentElement: Element = node instanceof HTMLElement ? node : parentElementGetter.call(node);
let currentElement: Element = node instanceof Element ? node : parentElementGetter.call(node);
while (!isNull(currentElement) && currentElement !== host) {
const elmOwnerKey = getNodeNearestOwnerKey(currentElement);
const parent: Element = parentElementGetter.call(currentElement);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:host {
display: block;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<svg lwc:dom="manual"></svg>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { LightningElement } from 'lwc';

export default class DomModeManualSvg extends LightningElement {
rendered = false
renderedCallback() {
if (this.rendered === false) {
this.rendered = true;
const elm = document.createElement('g');
this.template.querySelector('svg').appendChild(elm);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const assert = require('assert');
describe('CSS token on manual svg dom node', () => {
const URL = 'http://localhost:4567/lwc-dom-mode-manual-svg';

before(() => {
browser.url(URL);
});

it('should have token', () => {

const elm = browser.execute(function () {
return document.querySelector('integration-lwc-dom-mode-manual-svg').shadowRoot.querySelector('g');
});

browser.waitUntil(() => {
return elm.getAttribute('integration-lwc-dom-mode-manual-svg_lwc-dom-mode-manual-svg') === '';
}, 500, '<g> should have css token');

});
});

0 comments on commit 4851400

Please sign in to comment.