Skip to content

Commit

Permalink
test: simple end-to-end verification
Browse files Browse the repository at this point in the history
  • Loading branch information
ekashida committed Aug 30, 2019
1 parent ee2334d commit 6c4b706
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/@lwc/engine/src/framework/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import { ENABLE_FOO } from '@lwc/features';
import assert from '../shared/assert';
import { isUndefined, assign, isNull, isObject, isFunction, toString } from '../shared/language';
import { createVM, removeRootVM, appendRootVM, getCustomElementVM, VMState } from './vm';
Expand Down Expand Up @@ -78,6 +79,9 @@ interface CreateElementOptions {
* then it throws a TypeError.
*/
export function createElement(sel: string, options: CreateElementOptions): HTMLElement {
if (ENABLE_FOO) {
throw new Error('this feature throws an error');
}
if (!isObject(options) || isNull(options)) {
throw new TypeError(
`"createElement" function expects an object as second parameter but received "${toString(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { createElement } from 'lwc';
import { enableFeature } from 'features';
import XTest from 'x/test';
import XSlotted from 'x/slotted';
import NestedRenderConditional from 'x/nestedRenderConditional';

describe('if:true directive', () => {
enableFeature('ENABLE_FOO');

it('should render if the value is truthy', () => {
const elm = createElement('x-test', { is: XTest });
elm.isVisible = true;
Expand Down

0 comments on commit 6c4b706

Please sign in to comment.