Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/create-rslib/template-vue-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "rslib",
"dev": "rslib --watch",
Expand All @@ -27,12 +24,14 @@
"@rstest/adapter-rslib": "^0.11.6",
"@rstest/core": "^0.11.6",
"@testing-library/jest-dom": "^7.0.0",
"@testing-library/vue": "^8.1.0",
"@vue/test-utils": "^2.4.11",
"happy-dom": "^20.11.1",
"vue": "^3.5.40"
},
"peerDependencies": {
"vue": "^3.2.0"
},
"publishConfig": {
"access": "public"
}
}
4 changes: 3 additions & 1 deletion packages/create-rslib/template-vue-js/rstest.setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { expect } from '@rstest/core';
import { afterEach, expect } from '@rstest/core';
import * as jestDomMatchers from '@testing-library/jest-dom/matchers';
import { enableAutoUnmount } from '@vue/test-utils';

expect.extend(jestDomMatchers);
enableAutoUnmount(afterEach);
12 changes: 7 additions & 5 deletions packages/create-rslib/template-vue-js/tests/index.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { expect, test } from '@rstest/core';
import { render, screen } from '@testing-library/vue';
import { mount } from '@vue/test-utils';
import Button from '../src/Button.vue';

test('The button should have correct background color', async () => {
render(Button, {
test('The button should have correct background color', () => {
const wrapper = mount(Button, {
attachTo: document.body,
Comment thread
chenjiahan marked this conversation as resolved.
props: {
backgroundColor: '#ccc',
Comment thread
chenjiahan marked this conversation as resolved.
label: 'Demo Button',
},
});
const button = screen.getByText('Demo Button');
expect(button).toHaveStyle({
const button = wrapper.get('button');
expect(button.text()).toBe('Demo Button');
expect(button.element).toHaveStyle({
backgroundColor: '#ccc',
});
});
7 changes: 3 additions & 4 deletions packages/create-rslib/template-vue-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "rslib && vue-tsc",
"dev": "rslib --watch",
Expand All @@ -27,7 +24,6 @@
"@rstest/adapter-rslib": "^0.11.6",
"@rstest/core": "^0.11.6",
"@testing-library/jest-dom": "^7.0.0",
"@testing-library/vue": "^8.1.0",
"@vue/test-utils": "^2.4.11",
"happy-dom": "^20.11.1",
"typescript": "^6.0.3",
Expand All @@ -36,5 +32,8 @@
},
"peerDependencies": {
"vue": "^3.2.0"
},
"publishConfig": {
"access": "public"
}
}
4 changes: 3 additions & 1 deletion packages/create-rslib/template-vue-ts/rstest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { expect } from '@rstest/core';
import { afterEach, expect } from '@rstest/core';
import * as jestDomMatchers from '@testing-library/jest-dom/matchers';
import { enableAutoUnmount } from '@vue/test-utils';

expect.extend(jestDomMatchers);
enableAutoUnmount(afterEach);
12 changes: 7 additions & 5 deletions packages/create-rslib/template-vue-ts/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { expect, test } from '@rstest/core';
import { render, screen } from '@testing-library/vue';
import { mount } from '@vue/test-utils';
import Button from '../src/Button.vue';

test('The button should have correct background color', async () => {
render(Button, {
test('The button should have correct background color', () => {
const wrapper = mount(Button, {
attachTo: document.body,
props: {
backgroundColor: '#ccc',
Comment thread
chenjiahan marked this conversation as resolved.
label: 'Demo Button',
},
});
const button = screen.getByText('Demo Button');
expect(button).toHaveStyle({
const button = wrapper.get('button');
expect(button.text()).toBe('Demo Button');
expect(button.element).toHaveStyle({
backgroundColor: '#ccc',
});
});