Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add layout component #1393

Merged
merged 4 commits into from
Jun 20, 2024
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
8 changes: 8 additions & 0 deletions site/docs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ export const docs = [
component: () => import('@/icon/icon.md'),
componentEn: () => import('@/icon/icon.en-US.md'),
},
{
title: 'Layout 布局',
titleEn: 'Layout',
name: 'col',
path: '/mobile-vue/components/col',
component: () => import('@/col/col.md'),
componentEn: () => import('@/col/col.en-US.md'),
},
{
title: 'Link 链接',
titleEn: 'Link',
Expand Down
320 changes: 320 additions & 0 deletions src/col/__test__/__snapshots__/demo.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,320 @@
// Vitest Snapshot v1

exports[`Col > Col baseVue demo works fine 1`] = `
<div
data-v-app=""
>

<div
class="t-row"
data-v-560c89d0=""
>

<div
class="t-col t-col--8 dark"
data-v-560c89d0=""
>

col-8

</div>
<div
class="t-col t-col--8 light"
data-v-560c89d0=""
>

col-8

</div>
<div
class="t-col t-col--8 dark"
data-v-560c89d0=""
>

col-8

</div>

</div>
<div
class="t-row"
data-v-560c89d0=""
>

<div
class="t-col t-col--4 dark"
data-v-560c89d0=""
>

col-4

</div>
<div
class="t-col t-col--offset-4 t-col--16 light"
data-v-560c89d0=""
>

col-16 col-offset-4

</div>

</div>
<div
class="t-row"
data-v-560c89d0=""
>

<div
class="t-col t-col--offset-12 t-col--12 dark"
data-v-560c89d0=""
>

col-12 col-offset-12

</div>

</div>

</div>
`;

exports[`Col > Col mobileVue demo works fine 1`] = `
<div
class="tdesign-mobile-demo"
data-v-6ebf24a9=""
>
<h1
class="title"
data-v-6ebf24a9=""
>
Layout 布局
</h1>
<p
class="summary"
data-v-6ebf24a9=""
>
以规则的网格阵列来指导和规范页面中的版面布局以及信息分布,提高界面内布局的一致性,节约成本。
</p>
<div
class="tdesign-mobile-demo-block"
data-v-6ebf24a9=""
>
<div
class="tdesign-mobile-demo-block__header"
>
<h2
class="tdesign-mobile-demo-block__title"
>
01 组件类型
</h2>
<p
class="tdesign-mobile-demo-block__summary"
>
基础用法
</p>
</div>
<div
class="tdesign-mobile-demo-block__slot"
>


<div
class="t-row"
data-v-560c89d0=""
>

<div
class="t-col t-col--8 dark"
data-v-560c89d0=""
>

col-8

</div>
<div
class="t-col t-col--8 light"
data-v-560c89d0=""
>

col-8

</div>
<div
class="t-col t-col--8 dark"
data-v-560c89d0=""
>

col-8

</div>

</div>
<div
class="t-row"
data-v-560c89d0=""
>

<div
class="t-col t-col--4 dark"
data-v-560c89d0=""
>

col-4

</div>
<div
class="t-col t-col--offset-4 t-col--16 light"
data-v-560c89d0=""
>

col-16 col-offset-4

</div>

</div>
<div
class="t-row"
data-v-560c89d0=""
>

<div
class="t-col t-col--offset-12 t-col--12 dark"
data-v-560c89d0=""
>

col-12 col-offset-12

</div>

</div>


</div>
</div>
<div
class="tdesign-mobile-demo-block tdesign-mobile-demo-block_notitle"
data-v-6ebf24a9=""
>
<div
class="tdesign-mobile-demo-block__header"
>
<!--v-if-->
<p
class="tdesign-mobile-demo-block__summary tdesign-mobile-demo-block_subtitle"
>
在列元素之间增加间距
</p>
</div>
<div
class="tdesign-mobile-demo-block__slot"
>

<div
class="t-row"
data-v-6ebf24a9=""
data-v-7362cfcc=""
style="margin-right: -8px; margin-left: -8px;"
>

<div
class="t-col t-col--8"
data-v-7362cfcc=""
style="padding-right: 8px; padding-left: 8px;"
>

<div
class="dark"
data-v-7362cfcc=""
>
col-8
</div>

</div>
<div
class="t-col t-col--8"
data-v-7362cfcc=""
style="padding-right: 8px; padding-left: 8px;"
>

<div
class="dark"
data-v-7362cfcc=""
>
col-8
</div>

</div>
<div
class="t-col t-col--8"
data-v-7362cfcc=""
style="padding-right: 8px; padding-left: 8px;"
>

<div
class="dark"
data-v-7362cfcc=""
>
col-8
</div>

</div>

</div>

</div>
</div>
</div>
`;

exports[`Col > Col offsetVue demo works fine 1`] = `
<div
class="t-row"
data-v-7362cfcc=""
style="margin-right: -8px; margin-left: -8px;"
>

<div
class="t-col t-col--8"
data-v-7362cfcc=""
style="padding-right: 8px; padding-left: 8px;"
>

<div
class="dark"
data-v-7362cfcc=""
>
col-8
</div>

</div>
<div
class="t-col t-col--8"
data-v-7362cfcc=""
style="padding-right: 8px; padding-left: 8px;"
>

<div
class="dark"
data-v-7362cfcc=""
>
col-8
</div>

</div>
<div
class="t-col t-col--8"
data-v-7362cfcc=""
style="padding-right: 8px; padding-left: 8px;"
>

<div
class="dark"
data-v-7362cfcc=""
>
col-8
</div>

</div>

</div>
`;
23 changes: 23 additions & 0 deletions src/col/__test__/demo.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* 该文件为由脚本 `npm run test:demo` 自动生成,如需修改,执行脚本命令即可。请勿手写直接修改,否则会被覆盖
*/

import { mount } from '@vue/test-utils';
import baseVue from '@/col/demos/base.vue';
import mobileVue from '@/col/demos/mobile.vue';
import offsetVue from '@/col/demos/offset.vue';

const mapper = {
baseVue,
mobileVue,
offsetVue,
};

describe('Col', () => {
Object.keys(mapper).forEach((demoName) => {
it(`Col ${demoName} demo works fine`, () => {
const wrapper = mount(mapper[demoName]);
expect(wrapper.element).toMatchSnapshot();
});
});
});
Loading
Loading