audio支持变量

This commit is contained in:
catchonme 2019-07-04 16:22:24 +08:00
parent 8350be3fc8
commit 0e89b87a03
5 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,49 @@
import React = require('react');
import {render, fireEvent} from 'react-testing-library';
import '../../src/themes/default';
import {
render as amisRender
} from '../../src/index';
import { makeEnv } from '../helper';
test('Renderer:dropdown-button', async () => {
const {
container
} = render(amisRender({
type: 'dropdown-button',
level: 'primary',
buttons: [
{
type: 'button',
label: '按钮',
actionType: 'dialog',
dialog: {
title: '系统提示',
body: '对你点击了'
}
},
{
type: 'button',
label: '按钮',
actionType: 'dialog',
dialog: {
title: '系统提示',
body: '对你点击了'
}
},
{
type: 'button',
label: '按钮',
visible: false
}
],
className: 'show'
}, {}, makeEnv({
})));
const dropdowmButton = document.querySelector('button.a-Button');
fireEvent.click(dropdowmButton as HTMLDivElement);
expect(container).toMatchSnapshot();
fireEvent.click(dropdowmButton as HTMLDivElement);
expect(container).toMatchSnapshot();
});

View File

@ -0,0 +1,24 @@
import React = require('react');
import {render} from 'react-testing-library';
import '../../src/themes/default';
import {
render as amisRender
} from '../../src/index';
import { makeEnv } from '../helper';
test('Renderer:each', async () => {
const {
container
} = render(amisRender({
type: 'each',
items: {
type: 'tpl',
tpl: '<%= data.name %>'
},
value: [{name: 'jack'}, {name: 'martin'}],
className: 'show'
}, {}, makeEnv({
})));
expect(container).toMatchSnapshot();
});

View File

@ -0,0 +1,51 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Renderer:dropdown-button 1`] = `
<div>
<div
class="a-DropDown is-opened"
>
<button
class="a-Button show a-Button--primary"
>
<i
class="a-DropDown-caret fa fa-angle-down"
/>
</button>
<ul
class="a-DropDown-menu"
>
<li>
<a
class=""
>
按钮
</a>
</li>
<li>
<a
class=""
>
按钮
</a>
</li>
</ul>
</div>
</div>
`;
exports[`Renderer:dropdown-button 2`] = `
<div>
<div
class="a-DropDown "
>
<button
class="a-Button show a-Button--primary"
>
<i
class="a-DropDown-caret fa fa-angle-down"
/>
</button>
</div>
</div>
`;

View File

@ -0,0 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Renderer:each 1`] = `
<div>
<div
class="show"
>
<span
class="a-TplField"
>
jack
</span>
<span
class="a-TplField"
>
martin
</span>
</div>
</div>
`;

View File

@ -0,0 +1,18 @@
### Rating
评分
- `type` 请设置成 `rating`
- `half` 是否使用半星选择
- `count` 共有多少星可供选择
- `readOnly` 只读
```schema:height="200" scope="form-item"
{
"type": "rating",
"name": "rating",
"label": "评分",
"count": 5,
"half": true
}
```