Skip to content

Commit 262fd1c

Browse files
committed
Add vue, svlete tests
1 parent 3dccd5f commit 262fd1c

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

libraries/svelte/src/basic-tests.js

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
ComponentWithProperties,
2525
ComponentWithUnregistered,
2626
ComponentWithImperativeEvent,
27+
ComponentWithMethods,
2728
} from "./components";
2829
import { tick } from "svelte";
2930

@@ -125,6 +126,12 @@ describe("basic support", function() {
125126
expect(data).to.eql("svelte");
126127
});
127128

129+
it('will not overwrite methods', function () {
130+
new ComponentWithMethods({ target: scratch });
131+
const wc = scratch.querySelector('#wc');
132+
expect(wc.innerText).to.eql('Success');
133+
})
134+
128135
// it('will set boolean attributes on a Custom Element that has not already been defined and upgraded', function() {
129136
// new ComponentWithUnregistered({ target: scratch });
130137
// let wc = scratch.querySelector("#wc");

libraries/svelte/src/components.js

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import 'ce-without-children';
1919
import 'ce-with-children';
2020
import 'ce-with-properties';
2121
import 'ce-with-event';
22+
import 'ce-with-methods';
2223

2324
export { default as ComponentWithoutChildren } from './components/ComponentWithoutChildren.svelte';
2425
export { default as ComponentWithChildren } from './components/ComponentWithChildren.svelte';
@@ -28,3 +29,4 @@ export { default as ComponentWithProperties } from './components/ComponentWithPr
2829
export { default as ComponentWithUnregistered } from './components/ComponentWithUnregistered.svelte';
2930
export { default as ComponentWithImperativeEvent } from './components/ComponentWithImperativeEvent.svelte';
3031
export { default as ComponentWithDeclarativeEvent } from './components/ComponentWithDeclarativeEvent.svelte';
32+
export { default as ComponentWithMethods } from './components/ComponentWithMethods.svelte';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<ce-with-methods id="wc" true></ce-with-methods>

libraries/vue/src/basic-tests.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import {
2424
ComponentWithProperties,
2525
ComponentWithUnregistered,
2626
ComponentWithImperativeEvent,
27-
ComponentWithDeclarativeEvent
27+
ComponentWithDeclarativeEvent,
28+
ComponentWithMethods
2829
} from "./components";
2930
import { expect } from "chai";
3031

@@ -147,6 +148,13 @@ describe("basic support", function() {
147148
expect(data).to.eql("Vue");
148149
});
149150

151+
it('will not overwrite methods', function () {
152+
const app = createApp(ComponentWithMethods);
153+
app.mount(scratch);
154+
const wc = scratch.querySelector('#wc');
155+
expect(wc.innerText).to.eql('Success');
156+
})
157+
150158
// it('will set boolean attributes on a Custom Element that has not already been defined and upgraded', function() {
151159
// let root = new ComponentWithUnregistered().$mount(scratch).$el;
152160
// let wc = root.querySelector('#wc');

libraries/vue/src/components.js

+11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import 'ce-without-children';
2020
import 'ce-with-children';
2121
import 'ce-with-properties';
2222
import 'ce-with-event';
23+
import 'ce-with-methods';
2324

2425
export const ComponentWithoutChildren = defineComponent({
2526
template: `
@@ -100,6 +101,16 @@ export const ComponentWithProperties = defineComponent({
100101
}
101102
});
102103

104+
export const ComponentWithMethods = defineComponent({
105+
template: `
106+
<div>
107+
<ce-with-methods id="wc"
108+
:test.attr="true"
109+
></ce-with-methods>
110+
</div>
111+
`
112+
})
113+
103114
export const ComponentWithUnregistered = defineComponent({
104115
template: `
105116
<div>

0 commit comments

Comments
 (0)