Skip to content

Commit 4be2a04

Browse files
authored
test: update test to use lwc imports (#2794)
1 parent 3a47f2f commit 4be2a04

File tree

9 files changed

+17
-36
lines changed

9 files changed

+17
-36
lines changed

packages/integration-karma/test/act/index.spec.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { createElement, LightningElement } from 'lwc';
1+
import {
2+
createElement,
3+
LightningElement,
4+
registerComponent,
5+
registerTemplate,
6+
registerDecorators,
7+
} from 'lwc';
8+
29
import HtmlTags from 'html/tags';
310
import UiSomething from 'ui/something';
411
import UiSomethingElse from 'ui/somethingElse';
@@ -29,9 +36,6 @@ import testStyleAttr from './act-components/test-style-attr';
2936
// Tests that confirm that the runtime LWC engine-dom is compatible with the compiled templates
3037
// from the ACTCompiler
3138
describe('ACTCompiler', () => {
32-
// These can't be imported from 'lwc'` because @lwc/rollup-plugin won't allow it
33-
const { registerComponent, registerTemplate, registerDecorators } = LWC;
34-
3539
function createComponentFromTemplate(
3640
template,
3741
{ props = {}, propsToTrack = [], methods = {} } = {}

packages/integration-karma/test/api/isNodeFromTemplate/index.spec.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// TODO [#1284]: Import this from the lwc module once we move validation from compiler to linter
2-
const { isNodeFromTemplate } = LWC;
3-
4-
import { createElement } from 'lwc';
1+
import { createElement, isNodeFromTemplate } from 'lwc';
52
import Test from 'x/test';
63

74
function testNonNodes(type, obj) {

packages/integration-karma/test/api/registerTemplate/index.spec.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// TODO [#1284]: Import this from the lwc module once we move validation from compiler to linter
2-
const { registerTemplate } = LWC;
3-
4-
import { createElement } from 'lwc';
1+
import { createElement, registerTemplate } from 'lwc';
52
import { LightningElement } from 'lwc';
63

74
it('should accepts a function return the same value', () => {

packages/integration-karma/test/component/LightningElement.render/index.spec.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import { createElement } from 'lwc';
1+
import { createElement, registerTemplate } from 'lwc';
22

33
import DynamicTemplate, { template1, template2 } from 'x/dynamicTemplate';
44
import RenderThrow from 'x/renderThrow';
55

6-
// TODO [#1284]: Import this from the lwc module once we move validation from compiler to linter
7-
const { registerTemplate } = LWC;
8-
96
function testInvalidTemplate(type, template) {
107
it(`throws an error if returns ${type}`, () => {
118
const elm = createElement('x-dynamic-template', { is: DynamicTemplate });

packages/integration-karma/test/rendering/version-mismatch/index.spec.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import { createElement, LightningElement } from 'lwc';
1+
import { createElement, LightningElement, registerTemplate, registerComponent } from 'lwc';
22
import Component from 'x/component';
33
import ComponentWithProp from 'x/componentWithProp';
44
import ComponentWithTemplateAndStylesheet from 'x/componentWithTemplateAndStylesheet';
55

6-
// TODO [#1284]: Import this from the lwc module once we move validation from compiler to linter
7-
const { registerTemplate, registerComponent } = LWC;
8-
96
if (!process.env.COMPAT) {
107
describe('compiler version mismatch', () => {
118
describe('stamped with version number', () => {

packages/integration-karma/test/services/hooks/index.spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { createElement } from 'lwc';
1+
import { createElement, register } from 'lwc';
22

33
import XHooks from 'x/hooks';
44

5-
const { register } = LWC;
6-
75
describe('Service hooks', () => {
86
let entries = [];
97

packages/integration-karma/test/swapping/components/index.spec.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import { createElement, setFeatureFlagForTest } from 'lwc';
2-
3-
// TODO [#1869]: getting the global API from global LWC in tests until it is allowed in compiler
4-
const { swapComponent } = LWC;
1+
import { createElement, setFeatureFlagForTest, swapComponent } from 'lwc';
52

63
import Container from 'base/container';
74
import A from 'base/a';

packages/integration-karma/test/swapping/styles/index.spec.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { createElement } from 'lwc';
2-
3-
// TODO [#1869]: getting the global API from global LWC in tests until it is allowed in compiler
4-
const { swapStyle } = LWC;
5-
1+
import { createElement, swapStyle } from 'lwc';
62
import Simple from 'base/simple';
3+
74
const { blockStyle, inlineStyle, noneStyle } = Simple;
85

96
describe('style swapping', () => {

packages/integration-karma/test/swapping/templates/index.spec.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import { createElement } from 'lwc';
2-
3-
// TODO [#1869]: getting the global API from global LWC in tests until it is allowed in compiler
4-
const { swapTemplate } = LWC;
1+
import { createElement, swapTemplate } from 'lwc';
52

63
import Simple from 'base/simple';
74
import Advanced from 'base/advanced';

0 commit comments

Comments
 (0)