@king-design/vue 3.7.0 → 3.8.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/__snapshots__/Vue Next Demos.md +399 -0
- package/components/bubble/bubble.d.ts +61 -0
- package/components/bubble/bubble.js +81 -0
- package/components/bubble/bubble.vdt.js +85 -0
- package/components/bubble/index.d.ts +1 -0
- package/components/bubble/index.js +1 -0
- package/components/bubble/index.spec.d.ts +1 -0
- package/components/bubble/index.spec.js +771 -0
- package/components/bubble/styles.d.ts +5 -0
- package/components/bubble/styles.js +53 -0
- package/components/bubble/useBubbleDisplay.d.ts +18 -0
- package/components/bubble/useBubbleDisplay.js +300 -0
- package/components/bubbleList/bubbleList.d.ts +87 -0
- package/components/bubbleList/bubbleList.js +75 -0
- package/components/bubbleList/bubbleList.vdt.js +143 -0
- package/components/bubbleList/index.d.ts +1 -0
- package/components/bubbleList/index.js +1 -0
- package/components/bubbleList/index.spec.d.ts +1 -0
- package/components/bubbleList/index.spec.js +1268 -0
- package/components/bubbleList/item.d.ts +16 -0
- package/components/bubbleList/item.js +27 -0
- package/components/bubbleList/item.vdt.js +36 -0
- package/components/bubbleList/styles.d.ts +5 -0
- package/components/bubbleList/styles.js +33 -0
- package/components/bubbleList/useBubbleList.d.ts +28 -0
- package/components/bubbleList/useBubbleList.js +455 -0
- package/components/checkbox/index.d.ts +3 -3
- package/components/fileCard/fileCard.d.ts +65 -0
- package/components/fileCard/fileCard.js +72 -0
- package/components/fileCard/fileCard.vdt.js +161 -0
- package/components/fileCard/fileCardAssets.d.ts +1 -0
- package/components/fileCard/fileCardAssets.js +54 -0
- package/components/fileCard/fileCardUtils.d.ts +14 -0
- package/components/fileCard/fileCardUtils.js +94 -0
- package/components/fileCard/index.d.ts +2 -0
- package/components/fileCard/index.js +2 -0
- package/components/fileCard/index.spec.d.ts +1 -0
- package/components/fileCard/index.spec.js +1096 -0
- package/components/fileCard/list.d.ts +29 -0
- package/components/fileCard/list.js +46 -0
- package/components/fileCard/list.vdt.js +71 -0
- package/components/fileCard/styles.d.ts +5 -0
- package/components/fileCard/styles.js +83 -0
- package/components/fileCard/useFileCard.d.ts +45 -0
- package/components/fileCard/useFileCard.js +330 -0
- package/components/fileCard/useFileCardList.d.ts +14 -0
- package/components/fileCard/useFileCardList.js +49 -0
- package/components/form/form.js +2 -1
- package/components/media/context.d.ts +6 -0
- package/components/media/context.js +2 -0
- package/components/media/group.d.ts +12 -0
- package/components/media/group.js +32 -0
- package/components/media/group.vdt.js +50 -0
- package/components/media/index.d.ts +2 -0
- package/components/media/index.js +2 -0
- package/components/media/index.spec.d.ts +1 -0
- package/components/media/index.spec.js +1691 -0
- package/components/media/media.d.ts +37 -0
- package/components/media/media.js +67 -0
- package/components/media/media.vdt.js +202 -0
- package/components/media/mediaAssets.d.ts +4 -0
- package/components/media/mediaAssets.js +9 -0
- package/components/media/mediaUtils.d.ts +6 -0
- package/components/media/mediaUtils.js +66 -0
- package/components/media/styles.d.ts +13 -0
- package/components/media/styles.js +52 -0
- package/components/media/types.d.ts +37 -0
- package/components/media/types.js +1 -0
- package/components/media/useMedia.d.ts +70 -0
- package/components/media/useMedia.js +471 -0
- package/components/media/useMediaGroup.d.ts +15 -0
- package/components/media/useMediaGroup.js +136 -0
- package/components/media/useMediaViewer.d.ts +14 -0
- package/components/media/useMediaViewer.js +129 -0
- package/components/media/viewer.d.ts +24 -0
- package/components/media/viewer.js +54 -0
- package/components/media/viewer.vdt.js +100 -0
- package/components/radio/index.d.ts +3 -3
- package/components/sender/icons.d.ts +3 -0
- package/components/sender/icons.js +17 -0
- package/components/sender/index.d.ts +1 -0
- package/components/sender/index.js +1 -0
- package/components/sender/index.spec.d.ts +1 -0
- package/components/sender/index.spec.js +1597 -0
- package/components/sender/sender.d.ts +104 -0
- package/components/sender/sender.js +111 -0
- package/components/sender/sender.vdt.js +230 -0
- package/components/sender/styles.d.ts +5 -0
- package/components/sender/styles.js +56 -0
- package/components/sender/useAutoResize.d.ts +4 -0
- package/components/sender/useAutoResize.js +99 -0
- package/components/sender/useSenderDrag.d.ts +6 -0
- package/components/sender/useSenderDrag.js +320 -0
- package/components/sender/useSenderInput.d.ts +16 -0
- package/components/sender/useSenderInput.js +101 -0
- package/components/sender/useSenderPaste.d.ts +5 -0
- package/components/sender/useSenderPaste.js +36 -0
- package/components/sender/useSenderUpload.d.ts +11 -0
- package/components/sender/useSenderUpload.js +395 -0
- package/components/skeleton/skeleton.d.ts +2 -1
- package/components/skeleton/skeleton.js +1 -1
- package/components/think/index.d.ts +1 -0
- package/components/think/index.js +1 -0
- package/components/think/index.spec.d.ts +1 -0
- package/components/think/index.spec.js +345 -0
- package/components/think/index.vdt.js +82 -0
- package/components/think/styles.d.ts +5 -0
- package/components/think/styles.js +25 -0
- package/components/think/think.d.ts +28 -0
- package/components/think/think.js +48 -0
- package/components/think/useThinkExpand.d.ts +10 -0
- package/components/think/useThinkExpand.js +56 -0
- package/components/types.d.ts +4 -2
- package/components/upload/ajaxUploader.d.ts +1 -0
- package/components/upload/ajaxUploader.js +6 -0
- package/components/xmarkdown/index.d.ts +2 -0
- package/components/xmarkdown/index.js +1 -0
- package/components/xmarkdown/index.spec.d.ts +1 -0
- package/components/xmarkdown/index.spec.js +1666 -0
- package/components/xmarkdown/markdown/codeBlockRenderer.d.ts +8 -0
- package/components/xmarkdown/markdown/codeBlockRenderer.js +52 -0
- package/components/xmarkdown/markdown/codeblock.d.ts +8 -0
- package/components/xmarkdown/markdown/codeblock.js +74 -0
- package/components/xmarkdown/markdown/highlight.d.ts +17 -0
- package/components/xmarkdown/markdown/highlight.js +83 -0
- package/components/xmarkdown/markdown/index.d.ts +14 -0
- package/components/xmarkdown/markdown/index.js +14 -0
- package/components/xmarkdown/markdown/mermaid.d.ts +8 -0
- package/components/xmarkdown/markdown/mermaid.js +104 -0
- package/components/xmarkdown/markdown/renderTree.d.ts +54 -0
- package/components/xmarkdown/markdown/renderTree.js +386 -0
- package/components/xmarkdown/markdown/renderer.d.ts +18 -0
- package/components/xmarkdown/markdown/renderer.js +461 -0
- package/components/xmarkdown/markdown/streaming.d.ts +24 -0
- package/components/xmarkdown/markdown/streaming.js +513 -0
- package/components/xmarkdown/markdown/types.d.ts +124 -0
- package/components/xmarkdown/markdown/types.js +6 -0
- package/components/xmarkdown/markdown/utils.d.ts +7 -0
- package/components/xmarkdown/markdown/utils.js +9 -0
- package/components/xmarkdown/markdown.d.ts +1 -0
- package/components/xmarkdown/markdown.js +1 -0
- package/components/xmarkdown/styles.d.ts +5 -0
- package/components/xmarkdown/styles.js +50 -0
- package/components/xmarkdown/useMermaid.d.ts +27 -0
- package/components/xmarkdown/useMermaid.js +745 -0
- package/components/xmarkdown/useXMarkdownContent.d.ts +14 -0
- package/components/xmarkdown/useXMarkdownContent.js +218 -0
- package/components/xmarkdown/useXMarkdownDisplay.d.ts +26 -0
- package/components/xmarkdown/useXMarkdownDisplay.js +569 -0
- package/components/xmarkdown/xmarkdown.d.ts +61 -0
- package/components/xmarkdown/xmarkdown.js +109 -0
- package/components/xmarkdown/xmarkdown.vdt.js +43 -0
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/i18n/en-US.js +29 -1
- package/dist/i18n/en-US.js.map +1 -1
- package/dist/i18n/en-US.min.js +1 -1
- package/dist/index.js +100506 -37457
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1569 -1
- package/dist/kpc.css +4 -0
- package/dist/ksyun.css +4 -0
- package/i18n/en-US.d.ts +27 -0
- package/i18n/en-US.js +29 -1
- package/index.d.ts +9 -2
- package/index.js +9 -2
- package/package.json +8 -2
- package/styles/global.js +12 -6
- package/yarn-error.log +0 -1012
|
@@ -0,0 +1,1096 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
5
|
+
import { Component } from 'intact-vue-next';
|
|
6
|
+
import { getElement, mount, unmount, wait } from '../../test/utils';
|
|
7
|
+
import { FileCard, FileCardList } from '.';
|
|
8
|
+
describe('FileCard', function () {
|
|
9
|
+
afterEach(function () {
|
|
10
|
+
unmount();
|
|
11
|
+
});
|
|
12
|
+
function expectViewerClosed() {
|
|
13
|
+
var viewer = document.querySelector('.k-media-viewer');
|
|
14
|
+
if (!viewer) {
|
|
15
|
+
expect(viewer).to.eql(null);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
expect(viewer.classList.contains('k-fade-leave-active') || viewer.classList.contains('k-fade-leave-to')).to.be.true;
|
|
19
|
+
}
|
|
20
|
+
function dispatchMediaEvent(target, eventName) {
|
|
21
|
+
target.dispatchEvent(new Event(eventName, {
|
|
22
|
+
bubbles: false,
|
|
23
|
+
cancelable: true
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
// 文件卡片和显式媒体卡片走不同外形,媒体内部复用 Media。
|
|
27
|
+
it('should render file and media card types with Media inside', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
28
|
+
var Demo, _mount, element;
|
|
29
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
30
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
33
|
+
_inheritsLoose(Demo, _Component);
|
|
34
|
+
function Demo() {
|
|
35
|
+
var _context;
|
|
36
|
+
var _this;
|
|
37
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
|
+
args[_key] = arguments[_key];
|
|
39
|
+
}
|
|
40
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
41
|
+
_this.FileCard = FileCard;
|
|
42
|
+
_this.FileCardList = FileCardList;
|
|
43
|
+
return _this;
|
|
44
|
+
}
|
|
45
|
+
return Demo;
|
|
46
|
+
}(Component);
|
|
47
|
+
Demo.template = "\n const { FileCard, FileCardList } = this;\n <div>\n <FileCard name=\"spec.pdf\" type=\"file\" byte={1024} src=\"https://example.com/spec.pdf\" />\n <FileCard name=\"cover.png\" type=\"image\" src=\"https://example.com/cover.png\" />\n <FileCardList items={[\n {key: 'video', name: 'demo.mp4', type: 'video', src: 'https://example.com/demo.mp4'},\n {key: 'audio', name: 'voice.mp3', type: 'audio', src: 'https://example.com/voice.mp3'},\n ]} />\n </div>\n ";
|
|
48
|
+
_mount = mount(Demo), element = _mount[1];
|
|
49
|
+
expect(element.querySelectorAll('.k-file-card').length).to.eql(4);
|
|
50
|
+
expect(element.querySelector('.k-file-card-file')).not.to.eql(null);
|
|
51
|
+
expect(element.querySelectorAll('.k-file-card-media').length).to.eql(3);
|
|
52
|
+
expect(element.querySelector('.k-file-card-type-image .k-media-image')).not.to.eql(null);
|
|
53
|
+
expect(element.querySelector('.k-file-card-type-video .k-media-video')).not.to.eql(null);
|
|
54
|
+
expect(element.querySelector('.k-file-card-type-audio .k-media-audio')).not.to.eql(null);
|
|
55
|
+
case 9:
|
|
56
|
+
case "end":
|
|
57
|
+
return _context2.stop();
|
|
58
|
+
}
|
|
59
|
+
}, _callee);
|
|
60
|
+
})));
|
|
61
|
+
// 显式媒体卡片可开启名称 Tooltip,文件行左侧媒体缩略图固定关闭。
|
|
62
|
+
it('should pass name tooltip setting to media cards only', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
63
|
+
var Demo, _mount2, element, imageMedia, videoMedia, audioMedia, listMedia, listMediaViews, listFileRowMedia, defaultMedia, fileRowMedia;
|
|
64
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context4) {
|
|
65
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
Demo = /*#__PURE__*/function (_Component2) {
|
|
68
|
+
_inheritsLoose(Demo, _Component2);
|
|
69
|
+
function Demo() {
|
|
70
|
+
var _context3;
|
|
71
|
+
var _this2;
|
|
72
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
73
|
+
args[_key2] = arguments[_key2];
|
|
74
|
+
}
|
|
75
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context3 = [this]).call(_context3, args)) || this;
|
|
76
|
+
_this2.FileCard = FileCard;
|
|
77
|
+
_this2.FileCardList = FileCardList;
|
|
78
|
+
return _this2;
|
|
79
|
+
}
|
|
80
|
+
return Demo;
|
|
81
|
+
}(Component);
|
|
82
|
+
Demo.template = "\n const { FileCard, FileCardList } = this;\n <div>\n <FileCard className=\"image-tooltip\" name=\"cover.png\" type=\"image\" src=\"https://example.com/cover.png\" showNameTooltip />\n <FileCard className=\"video-tooltip\" name=\"demo.mp4\" type=\"video\" src=\"https://example.com/demo.mp4\" showNameTooltip />\n <FileCard className=\"audio-tooltip\" name=\"voice.mp3\" type=\"audio\" src=\"https://example.com/voice.mp3\" showNameTooltip />\n <FileCard className=\"default-media-tooltip\" name=\"default.png\" type=\"image\" src=\"https://example.com/default.png\" />\n <FileCard className=\"file-row-tooltip\" name=\"row.png\" type=\"file\" src=\"https://example.com/row.png\" showNameTooltip />\n <FileCardList className=\"list-tooltip\" showNameTooltip items={[\n {key: 'audio', name: 'list.mp3', type: 'audio', src: 'https://example.com/list.mp3'},\n {key: 'image', name: 'list.png', type: 'image', src: 'https://example.com/list.png'},\n {key: 'video-off', name: 'off.mp4', type: 'video', src: 'https://example.com/off.mp4', showNameTooltip: false},\n {key: 'file-row', name: 'row-list.png', type: 'file', src: 'https://example.com/row-list.png'},\n ]} />\n </div>\n ";
|
|
83
|
+
_mount2 = mount(Demo), element = _mount2[1];
|
|
84
|
+
imageMedia = element.querySelector('.image-tooltip .k-file-card-media-view');
|
|
85
|
+
videoMedia = element.querySelector('.video-tooltip .k-file-card-media-view');
|
|
86
|
+
audioMedia = element.querySelector('.audio-tooltip .k-file-card-media-view');
|
|
87
|
+
listMedia = element.querySelector('.list-tooltip .k-file-card-media-view');
|
|
88
|
+
listMediaViews = element.querySelectorAll('.list-tooltip .k-file-card-media-view');
|
|
89
|
+
listFileRowMedia = element.querySelector('.list-tooltip .k-file-card-file-media-view');
|
|
90
|
+
defaultMedia = element.querySelector('.default-media-tooltip .k-file-card-media-view');
|
|
91
|
+
fileRowMedia = element.querySelector('.file-row-tooltip .k-file-card-file-media-view');
|
|
92
|
+
[imageMedia, videoMedia, audioMedia, listMedia, listMediaViews[1]].forEach(function (media) {
|
|
93
|
+
expect(media.querySelector('.k-media-name-tooltip-trigger')).not.to.eql(null);
|
|
94
|
+
expect(media.getAttribute('title')).to.eql(null);
|
|
95
|
+
});
|
|
96
|
+
expect(listMediaViews[2].querySelector('.k-media-name-tooltip-trigger')).to.eql(null);
|
|
97
|
+
expect(listMediaViews[2].getAttribute('title')).to.eql('off.mp4');
|
|
98
|
+
expect(listFileRowMedia.querySelector('.k-media-name-tooltip-trigger')).to.eql(null);
|
|
99
|
+
expect(listFileRowMedia.getAttribute('title')).to.eql('row-list.png');
|
|
100
|
+
expect(defaultMedia.querySelector('.k-media-name-tooltip-trigger')).to.eql(null);
|
|
101
|
+
expect(defaultMedia.getAttribute('title')).to.eql('default.png');
|
|
102
|
+
expect(fileRowMedia.querySelector('.k-media-name-tooltip-trigger')).to.eql(null);
|
|
103
|
+
expect(fileRowMedia.getAttribute('title')).to.eql('row.png');
|
|
104
|
+
case 20:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context4.stop();
|
|
107
|
+
}
|
|
108
|
+
}, _callee2);
|
|
109
|
+
})));
|
|
110
|
+
// 普通文件按扩展名使用内置设计图标。
|
|
111
|
+
it('should render builtin file icons by extension', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
112
|
+
var Demo, _mount3, element, word, sheet, txt, pdf, md, code, ppt, zip, fallback, imageNoSrc, videoNoPreview, audioNoPreview;
|
|
113
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context6) {
|
|
114
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
115
|
+
case 0:
|
|
116
|
+
Demo = /*#__PURE__*/function (_Component3) {
|
|
117
|
+
_inheritsLoose(Demo, _Component3);
|
|
118
|
+
function Demo() {
|
|
119
|
+
var _context5;
|
|
120
|
+
var _this3;
|
|
121
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
122
|
+
args[_key3] = arguments[_key3];
|
|
123
|
+
}
|
|
124
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context5 = [this]).call(_context5, args)) || this;
|
|
125
|
+
_this3.FileCard = FileCard;
|
|
126
|
+
return _this3;
|
|
127
|
+
}
|
|
128
|
+
return Demo;
|
|
129
|
+
}(Component);
|
|
130
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard className=\"word\" name=\"a.docx\" type=\"file\" />\n <FileCard className=\"sheet\" name=\"b.csv\" type=\"file\" />\n <FileCard className=\"txt\" name=\"c.txt\" type=\"file\" />\n <FileCard className=\"pdf\" name=\"d.pdf\" type=\"file\" />\n <FileCard className=\"md\" name=\"e.md\" type=\"file\" />\n <FileCard className=\"code\" name=\"f.ts\" type=\"file\" />\n <FileCard className=\"ppt\" name=\"g.pptx\" type=\"file\" />\n <FileCard className=\"zip\" name=\"h.zip\" type=\"file\" />\n <FileCard className=\"fallback\" name=\"i.unknown\" type=\"file\" />\n <FileCard className=\"image-no-src\" name=\"k.png\" type=\"file\" />\n <FileCard className=\"video-no-preview\" name=\"l.mp4\" type=\"file\" showPreview={false} src=\"https://example.com/l.mp4\" />\n <FileCard className=\"audio-no-preview\" name=\"m.mp3\" type=\"file\" showPreview={false} src=\"https://example.com/m.mp3\" />\n </div>\n ";
|
|
131
|
+
_mount3 = mount(Demo), element = _mount3[1];
|
|
132
|
+
word = element.querySelector('.word .k-file-card-file-icon-img').src;
|
|
133
|
+
sheet = element.querySelector('.sheet .k-file-card-file-icon-img').src;
|
|
134
|
+
txt = element.querySelector('.txt .k-file-card-file-icon-img').src;
|
|
135
|
+
pdf = element.querySelector('.pdf .k-file-card-file-icon-img').src;
|
|
136
|
+
md = element.querySelector('.md .k-file-card-file-icon-img').src;
|
|
137
|
+
code = element.querySelector('.code .k-file-card-file-icon-img').src;
|
|
138
|
+
ppt = element.querySelector('.ppt .k-file-card-file-icon-img').src;
|
|
139
|
+
zip = element.querySelector('.zip .k-file-card-file-icon-img').src;
|
|
140
|
+
fallback = element.querySelector('.fallback .k-file-card-file-icon-img').src;
|
|
141
|
+
imageNoSrc = element.querySelector('.image-no-src .k-file-card-file-icon-img').src;
|
|
142
|
+
videoNoPreview = element.querySelector('.video-no-preview .k-file-card-file-icon-img').src;
|
|
143
|
+
audioNoPreview = element.querySelector('.audio-no-preview .k-file-card-file-icon-img').src;
|
|
144
|
+
[word, sheet, txt, pdf, md, code, ppt, zip, fallback, imageNoSrc, videoNoPreview, audioNoPreview].forEach(function (src) {
|
|
145
|
+
expect(src).to.contain('data:image/svg+xml');
|
|
146
|
+
});
|
|
147
|
+
expect(word).not.to.eql(pdf);
|
|
148
|
+
expect(sheet).not.to.eql(zip);
|
|
149
|
+
expect(md).not.to.eql(code);
|
|
150
|
+
expect(imageNoSrc).not.to.eql(videoNoPreview);
|
|
151
|
+
expect(videoNoPreview).not.to.eql(audioNoPreview);
|
|
152
|
+
expect(element.querySelector('.video-no-preview .k-file-card-file-media-view')).to.eql(null);
|
|
153
|
+
expect(element.querySelector('.audio-no-preview .k-file-card-file-media-view')).to.eql(null);
|
|
154
|
+
case 23:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context6.stop();
|
|
157
|
+
}
|
|
158
|
+
}, _callee3);
|
|
159
|
+
})));
|
|
160
|
+
// type=file 始终保持文件行外形,但媒体资源会用左侧小 Media 缩略图。
|
|
161
|
+
it('should keep file layout and render media thumbnail for explicit file type', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
162
|
+
var _element$querySelecto, _element$querySelecto2;
|
|
163
|
+
var Demo, _mount4, element, card, media;
|
|
164
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context8) {
|
|
165
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
166
|
+
case 0:
|
|
167
|
+
Demo = /*#__PURE__*/function (_Component4) {
|
|
168
|
+
_inheritsLoose(Demo, _Component4);
|
|
169
|
+
function Demo() {
|
|
170
|
+
var _context7;
|
|
171
|
+
var _this4;
|
|
172
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
173
|
+
args[_key4] = arguments[_key4];
|
|
174
|
+
}
|
|
175
|
+
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context7 = [this]).call(_context7, args)) || this;
|
|
176
|
+
_this4.FileCard = FileCard;
|
|
177
|
+
return _this4;
|
|
178
|
+
}
|
|
179
|
+
return Demo;
|
|
180
|
+
}(Component);
|
|
181
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"\u5C01\u9762\u56FE.png\"\n type=\"file\"\n status=\"loading\"\n percent={30}\n src=\"https://example.com/cover.png\"\n />\n </div>\n ";
|
|
182
|
+
_mount4 = mount(Demo), element = _mount4[1];
|
|
183
|
+
card = element.querySelector('.k-file-card');
|
|
184
|
+
media = element.querySelector('.k-file-card-file-media-view');
|
|
185
|
+
expect(card.className).to.contain('k-file-card-file');
|
|
186
|
+
expect(card.className).not.to.contain('k-file-card-media');
|
|
187
|
+
expect(media).not.to.eql(null);
|
|
188
|
+
expect(media.className).to.contain('k-media-loading');
|
|
189
|
+
expect(media.className).not.to.contain('k-media-custom-loading');
|
|
190
|
+
expect(element.querySelector('.k-file-card-file-shell').style.getPropertyValue('--file-card-progress-percent')).to.eql('30%');
|
|
191
|
+
expect((_element$querySelecto = element.querySelector('.k-file-card-description')) == null ? void 0 : _element$querySelecto.textContent).to.contain('上传中... 30%');
|
|
192
|
+
expect((_element$querySelecto2 = element.querySelector('.k-file-card-description')) == null ? void 0 : _element$querySelecto2.textContent).not.to.contain('KB');
|
|
193
|
+
case 13:
|
|
194
|
+
case "end":
|
|
195
|
+
return _context8.stop();
|
|
196
|
+
}
|
|
197
|
+
}, _callee4);
|
|
198
|
+
})));
|
|
199
|
+
// 显式视频卡片 loading 时,进度展示在 loading 圈右侧,文案居中展示。
|
|
200
|
+
it('should pass status to media card and show video progress beside spinner', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
201
|
+
var _element$querySelecto3, _element$querySelecto4;
|
|
202
|
+
var Demo, _mount5, element, card, media;
|
|
203
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context10) {
|
|
204
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
205
|
+
case 0:
|
|
206
|
+
Demo = /*#__PURE__*/function (_Component5) {
|
|
207
|
+
_inheritsLoose(Demo, _Component5);
|
|
208
|
+
function Demo() {
|
|
209
|
+
var _context9;
|
|
210
|
+
var _this5;
|
|
211
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
212
|
+
args[_key5] = arguments[_key5];
|
|
213
|
+
}
|
|
214
|
+
_this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context9 = [this]).call(_context9, args)) || this;
|
|
215
|
+
_this5.FileCard = FileCard;
|
|
216
|
+
return _this5;
|
|
217
|
+
}
|
|
218
|
+
return Demo;
|
|
219
|
+
}(Component);
|
|
220
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"result.mp4\"\n type=\"video\"\n status=\"loading\"\n percent={56}\n loadingText=\"\u5904\u7406\u4E2D\"\n src=\"https://example.com/result.mp4\"\n />\n </div>\n ";
|
|
221
|
+
_mount5 = mount(Demo), element = _mount5[1];
|
|
222
|
+
card = element.querySelector('.k-file-card');
|
|
223
|
+
media = element.querySelector('.k-file-card-media-view');
|
|
224
|
+
expect(card.className).to.contain('k-file-card-media');
|
|
225
|
+
expect(card.className).to.contain('k-file-card-progressing');
|
|
226
|
+
expect(media.className).to.contain('k-media-loading');
|
|
227
|
+
expect(element.querySelector('.k-media-loading-indicator')).not.to.eql(null);
|
|
228
|
+
expect((_element$querySelecto3 = element.querySelector('.k-file-card-media-loading-text')) == null ? void 0 : _element$querySelecto3.textContent).to.contain('处理中');
|
|
229
|
+
expect((_element$querySelecto4 = element.querySelector('.k-file-card-media-progress-text')) == null ? void 0 : _element$querySelecto4.textContent).to.contain('56%');
|
|
230
|
+
case 11:
|
|
231
|
+
case "end":
|
|
232
|
+
return _context10.stop();
|
|
233
|
+
}
|
|
234
|
+
}, _callee5);
|
|
235
|
+
})));
|
|
236
|
+
// 显式图片卡片 loading 且有 percent 时,同样展示进度文案。
|
|
237
|
+
it('should show image progress beside spinner when loading', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
238
|
+
var _element$querySelecto5;
|
|
239
|
+
var Demo, _mount6, element;
|
|
240
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context12) {
|
|
241
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
242
|
+
case 0:
|
|
243
|
+
Demo = /*#__PURE__*/function (_Component6) {
|
|
244
|
+
_inheritsLoose(Demo, _Component6);
|
|
245
|
+
function Demo() {
|
|
246
|
+
var _context11;
|
|
247
|
+
var _this6;
|
|
248
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
249
|
+
args[_key6] = arguments[_key6];
|
|
250
|
+
}
|
|
251
|
+
_this6 = _Component6.call.apply(_Component6, _concatInstanceProperty(_context11 = [this]).call(_context11, args)) || this;
|
|
252
|
+
_this6.FileCard = FileCard;
|
|
253
|
+
return _this6;
|
|
254
|
+
}
|
|
255
|
+
return Demo;
|
|
256
|
+
}(Component);
|
|
257
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"cover.png\"\n type=\"image\"\n status=\"loading\"\n percent={43}\n src=\"https://example.com/cover.png\"\n />\n </div>\n ";
|
|
258
|
+
_mount6 = mount(Demo), element = _mount6[1];
|
|
259
|
+
expect(element.querySelector('.k-media-loading-indicator')).not.to.eql(null);
|
|
260
|
+
expect((_element$querySelecto5 = element.querySelector('.k-file-card-media-progress-text')) == null ? void 0 : _element$querySelecto5.textContent).to.contain('43%');
|
|
261
|
+
case 5:
|
|
262
|
+
case "end":
|
|
263
|
+
return _context12.stop();
|
|
264
|
+
}
|
|
265
|
+
}, _callee6);
|
|
266
|
+
})));
|
|
267
|
+
// 显式媒体卡片外层不额外定义尺寸,宽高完全跟随内部 Media。
|
|
268
|
+
it('should let media card size follow inner Media', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
269
|
+
var Demo, _mount7, element, card, media;
|
|
270
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context14) {
|
|
271
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
272
|
+
case 0:
|
|
273
|
+
Demo = /*#__PURE__*/function (_Component7) {
|
|
274
|
+
_inheritsLoose(Demo, _Component7);
|
|
275
|
+
function Demo() {
|
|
276
|
+
var _context13;
|
|
277
|
+
var _this7;
|
|
278
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
279
|
+
args[_key7] = arguments[_key7];
|
|
280
|
+
}
|
|
281
|
+
_this7 = _Component7.call.apply(_Component7, _concatInstanceProperty(_context13 = [this]).call(_context13, args)) || this;
|
|
282
|
+
_this7.FileCard = FileCard;
|
|
283
|
+
return _this7;
|
|
284
|
+
}
|
|
285
|
+
return Demo;
|
|
286
|
+
}(Component);
|
|
287
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard name=\"cover.png\" type=\"image\" size=\"small\" src=\"https://example.com/cover.png\" />\n </div>\n ";
|
|
288
|
+
_mount7 = mount(Demo), element = _mount7[1];
|
|
289
|
+
card = element.querySelector('.k-file-card');
|
|
290
|
+
media = element.querySelector('.k-media');
|
|
291
|
+
expect(getComputedStyle(card).width).to.eql(getComputedStyle(media).width);
|
|
292
|
+
expect(getComputedStyle(card).height).to.eql(getComputedStyle(media).height);
|
|
293
|
+
case 7:
|
|
294
|
+
case "end":
|
|
295
|
+
return _context14.stop();
|
|
296
|
+
}
|
|
297
|
+
}, _callee7);
|
|
298
|
+
})));
|
|
299
|
+
// 普通文件卡片默认宽度为 160px。
|
|
300
|
+
it('should render default file card width as 160px', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
301
|
+
var Demo, _mount8, element, card;
|
|
302
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context16) {
|
|
303
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
304
|
+
case 0:
|
|
305
|
+
Demo = /*#__PURE__*/function (_Component8) {
|
|
306
|
+
_inheritsLoose(Demo, _Component8);
|
|
307
|
+
function Demo() {
|
|
308
|
+
var _context15;
|
|
309
|
+
var _this8;
|
|
310
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
311
|
+
args[_key8] = arguments[_key8];
|
|
312
|
+
}
|
|
313
|
+
_this8 = _Component8.call.apply(_Component8, _concatInstanceProperty(_context15 = [this]).call(_context15, args)) || this;
|
|
314
|
+
_this8.FileCard = FileCard;
|
|
315
|
+
return _this8;
|
|
316
|
+
}
|
|
317
|
+
return Demo;
|
|
318
|
+
}(Component);
|
|
319
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard name=\"a.pdf\" type=\"file\" />\n </div>\n ";
|
|
320
|
+
_mount8 = mount(Demo), element = _mount8[1];
|
|
321
|
+
card = element.querySelector('.k-file-card');
|
|
322
|
+
expect(getComputedStyle(card).width).to.eql('160px');
|
|
323
|
+
case 5:
|
|
324
|
+
case "end":
|
|
325
|
+
return _context16.stop();
|
|
326
|
+
}
|
|
327
|
+
}, _callee8);
|
|
328
|
+
})));
|
|
329
|
+
// 显式媒体 loading 文案仅在指定 loadingText 时展示。
|
|
330
|
+
it('should show media loading text only when loadingText is specified', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
331
|
+
var _element$querySelecto6;
|
|
332
|
+
var Demo, _mount9, element;
|
|
333
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context18) {
|
|
334
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
335
|
+
case 0:
|
|
336
|
+
Demo = /*#__PURE__*/function (_Component9) {
|
|
337
|
+
_inheritsLoose(Demo, _Component9);
|
|
338
|
+
function Demo() {
|
|
339
|
+
var _context17;
|
|
340
|
+
var _this9;
|
|
341
|
+
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
|
342
|
+
args[_key9] = arguments[_key9];
|
|
343
|
+
}
|
|
344
|
+
_this9 = _Component9.call.apply(_Component9, _concatInstanceProperty(_context17 = [this]).call(_context17, args)) || this;
|
|
345
|
+
_this9.FileCard = FileCard;
|
|
346
|
+
return _this9;
|
|
347
|
+
}
|
|
348
|
+
return Demo;
|
|
349
|
+
}(Component);
|
|
350
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard name=\"a.png\" type=\"image\" status=\"loading\" src=\"https://example.com/a.png\" />\n <FileCard name=\"b.png\" type=\"image\" status=\"loading\" loadingText=\"\u5904\u7406\u4E2D\" src=\"https://example.com/b.png\" />\n <FileCard name=\"a.mp4\" type=\"video\" status=\"loading\" loadingText=\"\" src=\"https://example.com/a.mp4\" />\n </div>\n ";
|
|
351
|
+
_mount9 = mount(Demo), element = _mount9[1];
|
|
352
|
+
expect(element.querySelectorAll('.k-media-loading-indicator').length).to.eql(3);
|
|
353
|
+
expect(element.querySelectorAll('.k-file-card-media-loading-text').length).to.eql(1);
|
|
354
|
+
expect((_element$querySelecto6 = element.querySelector('.k-file-card-media-loading-text')) == null ? void 0 : _element$querySelecto6.textContent).to.contain('处理中');
|
|
355
|
+
case 6:
|
|
356
|
+
case "end":
|
|
357
|
+
return _context18.stop();
|
|
358
|
+
}
|
|
359
|
+
}, _callee9);
|
|
360
|
+
})));
|
|
361
|
+
// mini 文件卡片默认只展示图标和文件名,不展示描述区。
|
|
362
|
+
it('should hide description in mini file card', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
363
|
+
var _element$querySelecto7;
|
|
364
|
+
var Demo, _mount10, element, card;
|
|
365
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context20) {
|
|
366
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
367
|
+
case 0:
|
|
368
|
+
Demo = /*#__PURE__*/function (_Component10) {
|
|
369
|
+
_inheritsLoose(Demo, _Component10);
|
|
370
|
+
function Demo() {
|
|
371
|
+
var _context19;
|
|
372
|
+
var _this10;
|
|
373
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
374
|
+
args[_key10] = arguments[_key10];
|
|
375
|
+
}
|
|
376
|
+
_this10 = _Component10.call.apply(_Component10, _concatInstanceProperty(_context19 = [this]).call(_context19, args)) || this;
|
|
377
|
+
_this10.FileCard = FileCard;
|
|
378
|
+
return _this10;
|
|
379
|
+
}
|
|
380
|
+
return Demo;
|
|
381
|
+
}(Component);
|
|
382
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard name=\"voice.mp3\" type=\"file\" size=\"mini\" byte={1024} />\n </div>\n ";
|
|
383
|
+
_mount10 = mount(Demo), element = _mount10[1];
|
|
384
|
+
card = element.querySelector('.k-file-card');
|
|
385
|
+
expect(card.className).to.contain('k-file-card-mini');
|
|
386
|
+
expect((_element$querySelecto7 = element.querySelector('.k-file-card-title')) == null ? void 0 : _element$querySelecto7.textContent).to.contain('voice.mp3');
|
|
387
|
+
expect(element.querySelector('.k-file-card-description')).to.eql(null);
|
|
388
|
+
case 7:
|
|
389
|
+
case "end":
|
|
390
|
+
return _context20.stop();
|
|
391
|
+
}
|
|
392
|
+
}, _callee10);
|
|
393
|
+
})));
|
|
394
|
+
// mini 文件卡片在 loading/error 时,状态文案占据标题位置。
|
|
395
|
+
it('should show loading and error status text in mini file title area', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
396
|
+
var _cards$0$querySelecto, _cards$0$querySelecto2, _cards$1$querySelecto, _cards$1$querySelecto2;
|
|
397
|
+
var Demo, _mount11, element, cards;
|
|
398
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context22) {
|
|
399
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
400
|
+
case 0:
|
|
401
|
+
Demo = /*#__PURE__*/function (_Component11) {
|
|
402
|
+
_inheritsLoose(Demo, _Component11);
|
|
403
|
+
function Demo() {
|
|
404
|
+
var _context21;
|
|
405
|
+
var _this11;
|
|
406
|
+
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
|
407
|
+
args[_key11] = arguments[_key11];
|
|
408
|
+
}
|
|
409
|
+
_this11 = _Component11.call.apply(_Component11, _concatInstanceProperty(_context21 = [this]).call(_context21, args)) || this;
|
|
410
|
+
_this11.FileCard = FileCard;
|
|
411
|
+
return _this11;
|
|
412
|
+
}
|
|
413
|
+
return Demo;
|
|
414
|
+
}(Component);
|
|
415
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard name=\"uploading.pdf\" type=\"file\" size=\"mini\" status=\"loading\" percent={80} />\n <FileCard name=\"error.pdf\" type=\"file\" size=\"mini\" status=\"error\" />\n </div>\n ";
|
|
416
|
+
_mount11 = mount(Demo), element = _mount11[1];
|
|
417
|
+
cards = element.querySelectorAll('.k-file-card');
|
|
418
|
+
expect((_cards$0$querySelecto = cards[0].querySelector('.k-file-card-title')) == null ? void 0 : _cards$0$querySelecto.textContent).to.contain('上传中... 80%');
|
|
419
|
+
expect((_cards$0$querySelecto2 = cards[0].querySelector('.k-file-card-title')) == null ? void 0 : _cards$0$querySelecto2.textContent).not.to.contain('uploading.pdf');
|
|
420
|
+
expect((_cards$1$querySelecto = cards[1].querySelector('.k-file-card-title')) == null ? void 0 : _cards$1$querySelecto.textContent).to.contain('上传失败');
|
|
421
|
+
expect((_cards$1$querySelecto2 = cards[1].querySelector('.k-file-card-title')) == null ? void 0 : _cards$1$querySelecto2.textContent).not.to.contain('error.pdf');
|
|
422
|
+
expect(cards[1].querySelector('.k-file-card-title-status-error')).not.to.eql(null);
|
|
423
|
+
case 9:
|
|
424
|
+
case "end":
|
|
425
|
+
return _context22.stop();
|
|
426
|
+
}
|
|
427
|
+
}, _callee11);
|
|
428
|
+
})));
|
|
429
|
+
// type=file 的背景进度使用整张卡片底色,不再渲染 Progress 组件。
|
|
430
|
+
it('should render file progress as card background instead of Progress component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
431
|
+
var _element$querySelecto8, _element$querySelecto9;
|
|
432
|
+
var Demo, _mount12, element, card;
|
|
433
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context24) {
|
|
434
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
435
|
+
case 0:
|
|
436
|
+
Demo = /*#__PURE__*/function (_Component12) {
|
|
437
|
+
_inheritsLoose(Demo, _Component12);
|
|
438
|
+
function Demo() {
|
|
439
|
+
var _context23;
|
|
440
|
+
var _this12;
|
|
441
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
|
442
|
+
args[_key12] = arguments[_key12];
|
|
443
|
+
}
|
|
444
|
+
_this12 = _Component12.call.apply(_Component12, _concatInstanceProperty(_context23 = [this]).call(_context23, args)) || this;
|
|
445
|
+
_this12.FileCard = FileCard;
|
|
446
|
+
return _this12;
|
|
447
|
+
}
|
|
448
|
+
return Demo;
|
|
449
|
+
}(Component);
|
|
450
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard name=\"assets.zip\" type=\"file\" status=\"loading\" percent={62} byte={1024 * 20} />\n </div>\n ";
|
|
451
|
+
_mount12 = mount(Demo), element = _mount12[1];
|
|
452
|
+
card = element.querySelector('.k-file-card');
|
|
453
|
+
expect(element.querySelector('.k-file-card-file-shell').style.getPropertyValue('--file-card-progress-percent')).to.eql('62%');
|
|
454
|
+
expect(element.querySelector('.k-progress')).to.eql(null);
|
|
455
|
+
expect((_element$querySelecto8 = element.querySelector('.k-file-card-description')) == null ? void 0 : _element$querySelecto8.textContent).to.contain('上传中... 62%');
|
|
456
|
+
expect((_element$querySelecto9 = element.querySelector('.k-file-card-description')) == null ? void 0 : _element$querySelecto9.textContent).not.to.contain('KB');
|
|
457
|
+
case 8:
|
|
458
|
+
case "end":
|
|
459
|
+
return _context24.stop();
|
|
460
|
+
}
|
|
461
|
+
}, _callee12);
|
|
462
|
+
})));
|
|
463
|
+
// errorText 在文件错误状态下优先于 description 和 byte。
|
|
464
|
+
it('should prioritize errorText over description and byte when status is error', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
465
|
+
var _element$querySelecto10;
|
|
466
|
+
var Demo, _mount13, element, text;
|
|
467
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context26) {
|
|
468
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
469
|
+
case 0:
|
|
470
|
+
Demo = /*#__PURE__*/function (_Component13) {
|
|
471
|
+
_inheritsLoose(Demo, _Component13);
|
|
472
|
+
function Demo() {
|
|
473
|
+
var _context25;
|
|
474
|
+
var _this13;
|
|
475
|
+
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
|
476
|
+
args[_key13] = arguments[_key13];
|
|
477
|
+
}
|
|
478
|
+
_this13 = _Component13.call.apply(_Component13, _concatInstanceProperty(_context25 = [this]).call(_context25, args)) || this;
|
|
479
|
+
_this13.FileCard = FileCard;
|
|
480
|
+
return _this13;
|
|
481
|
+
}
|
|
482
|
+
return Demo;
|
|
483
|
+
}(Component);
|
|
484
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"broken.pdf\"\n type=\"file\"\n status=\"error\"\n description=\"\u666E\u901A\u63CF\u8FF0\"\n errorText=\"\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\"\n byte={1024 * 20}\n />\n </div>\n ";
|
|
485
|
+
_mount13 = mount(Demo), element = _mount13[1];
|
|
486
|
+
text = ((_element$querySelecto10 = element.querySelector('.k-file-card-description')) == null ? void 0 : _element$querySelecto10.textContent) || '';
|
|
487
|
+
expect(text).to.contain('上传失败,请重试');
|
|
488
|
+
expect(text).not.to.contain('普通描述');
|
|
489
|
+
expect(text).not.to.contain('20 KB');
|
|
490
|
+
case 7:
|
|
491
|
+
case "end":
|
|
492
|
+
return _context26.stop();
|
|
493
|
+
}
|
|
494
|
+
}, _callee13);
|
|
495
|
+
})));
|
|
496
|
+
// 显式图片上传失败且有 src 时,保留媒体画面、禁用预览,错误文案仅在指定 errorText 时展示。
|
|
497
|
+
it('should keep visual media visible and show error text only when specified', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
498
|
+
var _cards$1$querySelecto3;
|
|
499
|
+
var Demo, _mount14, element, cards, image, video;
|
|
500
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context28) {
|
|
501
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
502
|
+
case 0:
|
|
503
|
+
Demo = /*#__PURE__*/function (_Component14) {
|
|
504
|
+
_inheritsLoose(Demo, _Component14);
|
|
505
|
+
function Demo() {
|
|
506
|
+
var _context27;
|
|
507
|
+
var _this14;
|
|
508
|
+
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
|
509
|
+
args[_key14] = arguments[_key14];
|
|
510
|
+
}
|
|
511
|
+
_this14 = _Component14.call.apply(_Component14, _concatInstanceProperty(_context27 = [this]).call(_context27, args)) || this;
|
|
512
|
+
_this14.FileCard = FileCard;
|
|
513
|
+
return _this14;
|
|
514
|
+
}
|
|
515
|
+
return Demo;
|
|
516
|
+
}(Component);
|
|
517
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"cover.png\"\n type=\"image\"\n src=\"https://example.com/cover.png\"\n status=\"error\"\n />\n <FileCard\n name=\"clip.mp4\"\n type=\"video\"\n src=\"https://example.com/clip.mp4\"\n status=\"error\"\n errorText=\"\u4E0A\u4F20\u5931\u8D25\"\n />\n </div>\n ";
|
|
518
|
+
_mount14 = mount(Demo), element = _mount14[1];
|
|
519
|
+
cards = element.querySelectorAll('.k-file-card');
|
|
520
|
+
image = cards[0].querySelector('img.k-media-image');
|
|
521
|
+
video = cards[1].querySelector('video.k-media-video');
|
|
522
|
+
expect(cards[0].className).to.contain('k-file-card-error');
|
|
523
|
+
expect(cards[0].querySelector('.k-media-error-card')).to.eql(null);
|
|
524
|
+
expect(cards[1].querySelector('.k-media-error-card')).to.eql(null);
|
|
525
|
+
expect(image).not.to.eql(null);
|
|
526
|
+
expect(video).not.to.eql(null);
|
|
527
|
+
expect(cards[0].querySelector('.k-file-card-error-text')).to.eql(null);
|
|
528
|
+
expect((_cards$1$querySelecto3 = cards[1].querySelector('.k-file-card-error-text')) == null ? void 0 : _cards$1$querySelecto3.textContent).to.contain('上传失败');
|
|
529
|
+
expect(getComputedStyle(cards[0]).borderColor).not.to.eql('rgb(237, 64, 64)');
|
|
530
|
+
expect(element.querySelector('.k-media-placeholder')).to.eql(null);
|
|
531
|
+
expect(element.querySelector('.k-media-preview-trigger')).to.eql(null);
|
|
532
|
+
case 16:
|
|
533
|
+
case "end":
|
|
534
|
+
return _context28.stop();
|
|
535
|
+
}
|
|
536
|
+
}, _callee14);
|
|
537
|
+
})));
|
|
538
|
+
// 显式图片上传失败但 src 自身加载失败时,回退到上传失败 artwork。
|
|
539
|
+
it('should render upload error artwork when visual media src fails to load', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
|
|
540
|
+
var _element$querySelecto11, _artwork$querySelecto;
|
|
541
|
+
var Demo, _mount15, element, image, statusLayer, artwork;
|
|
542
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context30) {
|
|
543
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
544
|
+
case 0:
|
|
545
|
+
Demo = /*#__PURE__*/function (_Component15) {
|
|
546
|
+
_inheritsLoose(Demo, _Component15);
|
|
547
|
+
function Demo() {
|
|
548
|
+
var _context29;
|
|
549
|
+
var _this15;
|
|
550
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
|
551
|
+
args[_key15] = arguments[_key15];
|
|
552
|
+
}
|
|
553
|
+
_this15 = _Component15.call.apply(_Component15, _concatInstanceProperty(_context29 = [this]).call(_context29, args)) || this;
|
|
554
|
+
_this15.FileCard = FileCard;
|
|
555
|
+
return _this15;
|
|
556
|
+
}
|
|
557
|
+
return Demo;
|
|
558
|
+
}(Component);
|
|
559
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"cover.png\"\n type=\"image\"\n src=\"https://example.com/cover.png\"\n status=\"error\"\n errorText=\"\u4E0A\u4F20\u5931\u8D25\"\n />\n </div>\n ";
|
|
560
|
+
_mount15 = mount(Demo), element = _mount15[1];
|
|
561
|
+
image = element.querySelector('img.k-media-image');
|
|
562
|
+
statusLayer = element.querySelector('.k-file-card-media-status-layer');
|
|
563
|
+
expect(image, 'visual media should be shown before source fails').not.to.eql(null);
|
|
564
|
+
expect(statusLayer, 'specified errorText should render status layer while visual media is kept').not.to.eql(null);
|
|
565
|
+
dispatchMediaEvent(image, 'error');
|
|
566
|
+
_context30.next = 10;
|
|
567
|
+
return wait();
|
|
568
|
+
case 10:
|
|
569
|
+
_context30.next = 12;
|
|
570
|
+
return wait();
|
|
571
|
+
case 12:
|
|
572
|
+
artwork = element.querySelector('.k-file-card-media-error-artwork-content');
|
|
573
|
+
expect(artwork, "source failure should switch upload error text into artwork layout: " + ((_element$querySelecto11 = element.querySelector('.k-file-card')) == null ? void 0 : _element$querySelecto11.className)).not.to.eql(null);
|
|
574
|
+
expect(element.querySelector('.k-file-card-media-status-layer')).to.eql(null);
|
|
575
|
+
expect((_artwork$querySelecto = artwork.querySelector('.k-file-card-error-text')) == null ? void 0 : _artwork$querySelecto.textContent).to.contain('上传失败');
|
|
576
|
+
case 16:
|
|
577
|
+
case "end":
|
|
578
|
+
return _context30.stop();
|
|
579
|
+
}
|
|
580
|
+
}, _callee15);
|
|
581
|
+
})));
|
|
582
|
+
// 无 src 的显式媒体错误态使用灰色图标,错误文案仅在指定 errorText 时展示。
|
|
583
|
+
it('should render gray media error icon and show text only when errorText is specified', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
584
|
+
var Demo, _mount16, element, cards, shell, artwork, text, icon, style, artworkStyle;
|
|
585
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context32) {
|
|
586
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
587
|
+
case 0:
|
|
588
|
+
Demo = /*#__PURE__*/function (_Component16) {
|
|
589
|
+
_inheritsLoose(Demo, _Component16);
|
|
590
|
+
function Demo() {
|
|
591
|
+
var _context31;
|
|
592
|
+
var _this16;
|
|
593
|
+
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
|
594
|
+
args[_key16] = arguments[_key16];
|
|
595
|
+
}
|
|
596
|
+
_this16 = _Component16.call.apply(_Component16, _concatInstanceProperty(_context31 = [this]).call(_context31, args)) || this;
|
|
597
|
+
_this16.FileCard = FileCard;
|
|
598
|
+
return _this16;
|
|
599
|
+
}
|
|
600
|
+
return Demo;
|
|
601
|
+
}(Component);
|
|
602
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"cover.png\"\n type=\"image\"\n status=\"error\"\n errorText=\"\u4E0A\u4F20\u5931\u8D25\"\n />\n <FileCard\n name=\"clip.mp4\"\n type=\"video\"\n status=\"error\"\n />\n </div>\n ";
|
|
603
|
+
_mount16 = mount(Demo), element = _mount16[1];
|
|
604
|
+
cards = element.querySelectorAll('.k-file-card');
|
|
605
|
+
shell = cards[0].querySelector('.k-file-card-media-view .k-media-shell');
|
|
606
|
+
artwork = cards[0].querySelector('.k-file-card-media-error-artwork-content');
|
|
607
|
+
text = artwork.querySelector('.k-file-card-error-text');
|
|
608
|
+
icon = artwork.querySelector('.k-file-card-media-error-artwork-icon');
|
|
609
|
+
style = getComputedStyle(shell);
|
|
610
|
+
artworkStyle = getComputedStyle(artwork);
|
|
611
|
+
expect(style.boxShadow).to.eql('none');
|
|
612
|
+
expect(getComputedStyle(cards[0]).borderColor).not.to.eql('rgb(237, 64, 64)');
|
|
613
|
+
expect(style.borderTopColor).not.to.eql('rgb(237, 64, 64)');
|
|
614
|
+
expect(artwork).not.to.eql(null);
|
|
615
|
+
expect(icon.src).to.contain('ECECEC');
|
|
616
|
+
expect(text == null ? void 0 : text.textContent).to.contain('上传失败');
|
|
617
|
+
expect(artworkStyle.display).to.eql('flex');
|
|
618
|
+
expect(artworkStyle.flexDirection).to.eql('column');
|
|
619
|
+
expect(artworkStyle.alignItems).to.eql('center');
|
|
620
|
+
expect(artworkStyle.justifyContent).to.eql('center');
|
|
621
|
+
expect(artworkStyle.gap).to.eql('4px');
|
|
622
|
+
expect(getComputedStyle(icon).width).to.eql('32px');
|
|
623
|
+
expect(getComputedStyle(icon).height).to.eql('32px');
|
|
624
|
+
expect(getComputedStyle(text).color).to.eql('rgb(255, 68, 51)');
|
|
625
|
+
expect(cards[0].className).to.contain('k-file-card-media-error-artwork');
|
|
626
|
+
expect(cards[1].querySelector('.k-file-card-error-text')).to.eql(null);
|
|
627
|
+
expect(cards[1].querySelector('.k-file-card-media-error-artwork-content')).to.eql(null);
|
|
628
|
+
expect(cards[1].querySelector('.k-media-error-card')).not.to.eql(null);
|
|
629
|
+
case 28:
|
|
630
|
+
case "end":
|
|
631
|
+
return _context32.stop();
|
|
632
|
+
}
|
|
633
|
+
}, _callee16);
|
|
634
|
+
})));
|
|
635
|
+
// 显式视频在 mini 尺寸下,percent 仍会展示进度文本。
|
|
636
|
+
it('should show video progress text in mini size when percent is provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
|
|
637
|
+
var _element$querySelecto12;
|
|
638
|
+
var Demo, _mount17, element;
|
|
639
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context34) {
|
|
640
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
641
|
+
case 0:
|
|
642
|
+
Demo = /*#__PURE__*/function (_Component17) {
|
|
643
|
+
_inheritsLoose(Demo, _Component17);
|
|
644
|
+
function Demo() {
|
|
645
|
+
var _context33;
|
|
646
|
+
var _this17;
|
|
647
|
+
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
|
648
|
+
args[_key17] = arguments[_key17];
|
|
649
|
+
}
|
|
650
|
+
_this17 = _Component17.call.apply(_Component17, _concatInstanceProperty(_context33 = [this]).call(_context33, args)) || this;
|
|
651
|
+
_this17.FileCard = FileCard;
|
|
652
|
+
return _this17;
|
|
653
|
+
}
|
|
654
|
+
return Demo;
|
|
655
|
+
}(Component);
|
|
656
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"result.mp4\"\n type=\"video\"\n size=\"mini\"\n status=\"loading\"\n percent={56}\n src=\"https://example.com/result.mp4\"\n />\n </div>\n ";
|
|
657
|
+
_mount17 = mount(Demo), element = _mount17[1];
|
|
658
|
+
expect((_element$querySelecto12 = element.querySelector('.k-file-card-media-progress-text')) == null ? void 0 : _element$querySelecto12.textContent).to.contain('56%');
|
|
659
|
+
case 4:
|
|
660
|
+
case "end":
|
|
661
|
+
return _context34.stop();
|
|
662
|
+
}
|
|
663
|
+
}, _callee17);
|
|
664
|
+
})));
|
|
665
|
+
// 文件行卡片在 loading 时也允许自定义 mask 插槽渲染。
|
|
666
|
+
it('should render file mask slot even when status is loading', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
|
|
667
|
+
var _mask$querySelector;
|
|
668
|
+
var Demo, _mount18, element, mask;
|
|
669
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context36) {
|
|
670
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
671
|
+
case 0:
|
|
672
|
+
Demo = /*#__PURE__*/function (_Component18) {
|
|
673
|
+
_inheritsLoose(Demo, _Component18);
|
|
674
|
+
function Demo() {
|
|
675
|
+
var _context35;
|
|
676
|
+
var _this18;
|
|
677
|
+
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
|
678
|
+
args[_key18] = arguments[_key18];
|
|
679
|
+
}
|
|
680
|
+
_this18 = _Component18.call.apply(_Component18, _concatInstanceProperty(_context35 = [this]).call(_context35, args)) || this;
|
|
681
|
+
_this18.FileCard = FileCard;
|
|
682
|
+
return _this18;
|
|
683
|
+
}
|
|
684
|
+
return Demo;
|
|
685
|
+
}(Component);
|
|
686
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"a.pdf\"\n type=\"file\"\n status=\"loading\"\n >\n <b:mask>\n <span class=\"mask-content\">\u64CD\u4F5C\u533A</span>\n </b:mask>\n </FileCard>\n </div>\n ";
|
|
687
|
+
_mount18 = mount(Demo), element = _mount18[1];
|
|
688
|
+
mask = element.querySelector('.k-file-card-file-mask');
|
|
689
|
+
expect(mask).not.to.eql(null);
|
|
690
|
+
expect((_mask$querySelector = mask.querySelector('.mask-content')) == null ? void 0 : _mask$querySelector.textContent).to.contain('操作区');
|
|
691
|
+
case 6:
|
|
692
|
+
case "end":
|
|
693
|
+
return _context36.stop();
|
|
694
|
+
}
|
|
695
|
+
}, _callee18);
|
|
696
|
+
})));
|
|
697
|
+
// 文件行的 description/mask 插槽为空时,不保留空描述行和空遮罩层。
|
|
698
|
+
it('should not render wrappers for empty file description and mask slots', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
|
|
699
|
+
var Demo, _mount19, element;
|
|
700
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context38) {
|
|
701
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
702
|
+
case 0:
|
|
703
|
+
Demo = /*#__PURE__*/function (_Component19) {
|
|
704
|
+
_inheritsLoose(Demo, _Component19);
|
|
705
|
+
function Demo() {
|
|
706
|
+
var _context37;
|
|
707
|
+
var _this19;
|
|
708
|
+
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
|
709
|
+
args[_key19] = arguments[_key19];
|
|
710
|
+
}
|
|
711
|
+
_this19 = _Component19.call.apply(_Component19, _concatInstanceProperty(_context37 = [this]).call(_context37, args)) || this;
|
|
712
|
+
_this19.FileCard = FileCard;
|
|
713
|
+
return _this19;
|
|
714
|
+
}
|
|
715
|
+
return Demo;
|
|
716
|
+
}(Component);
|
|
717
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"a.pdf\"\n type=\"file\"\n >\n <b:description>\n <span v-if={false} class=\"empty-description\">\u63CF\u8FF0</span>\n </b:description>\n <b:mask>\n <span v-if={false} class=\"empty-mask\">\u64CD\u4F5C</span>\n </b:mask>\n </FileCard>\n </div>\n ";
|
|
718
|
+
_mount19 = mount(Demo), element = _mount19[1];
|
|
719
|
+
expect(element.querySelector('.k-file-card-description')).to.eql(null);
|
|
720
|
+
expect(element.querySelector('.k-file-card-file-mask')).to.eql(null);
|
|
721
|
+
case 5:
|
|
722
|
+
case "end":
|
|
723
|
+
return _context38.stop();
|
|
724
|
+
}
|
|
725
|
+
}, _callee19);
|
|
726
|
+
})));
|
|
727
|
+
// 显式媒体卡片会将 mask 扩展点透传给 Media,并由自定义按钮触发预览。
|
|
728
|
+
it('should forward mask slot to media card and open preview via mask action', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {
|
|
729
|
+
var _getElement;
|
|
730
|
+
var Demo, _mount20, instance, element, button;
|
|
731
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context40) {
|
|
732
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
733
|
+
case 0:
|
|
734
|
+
Demo = /*#__PURE__*/function (_Component20) {
|
|
735
|
+
_inheritsLoose(Demo, _Component20);
|
|
736
|
+
function Demo() {
|
|
737
|
+
var _context39;
|
|
738
|
+
var _this20;
|
|
739
|
+
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
|
740
|
+
args[_key20] = arguments[_key20];
|
|
741
|
+
}
|
|
742
|
+
_this20 = _Component20.call.apply(_Component20, _concatInstanceProperty(_context39 = [this]).call(_context39, args)) || this;
|
|
743
|
+
_this20.FileCard = FileCard;
|
|
744
|
+
return _this20;
|
|
745
|
+
}
|
|
746
|
+
Demo.defaults = function defaults() {
|
|
747
|
+
return {
|
|
748
|
+
previewCount: 0
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
return Demo;
|
|
752
|
+
}(Component);
|
|
753
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"cover.png\"\n type=\"image\"\n status=\"done\"\n src=\"https://example.com/cover.png\"\n ev-preview={() => this.set('previewCount', this.get('previewCount') + 1)}\n >\n <b:mask args=\"media\">\n <button\n class=\"media-mask-open\"\n type=\"button\"\n disabled={!media.canPreview}\n ev-click={media.preview}\n >open</button>\n </b:mask>\n </FileCard>\n </div>\n ";
|
|
754
|
+
_mount20 = mount(Demo), instance = _mount20[0], element = _mount20[1];
|
|
755
|
+
button = element.querySelector('.media-mask-open');
|
|
756
|
+
expect(button).not.to.eql(null);
|
|
757
|
+
expect(element.querySelector('.k-media-preview-trigger')).to.eql(null);
|
|
758
|
+
button.click();
|
|
759
|
+
_context40.next = 9;
|
|
760
|
+
return wait();
|
|
761
|
+
case 9:
|
|
762
|
+
expect(instance.get('previewCount')).to.eql(1);
|
|
763
|
+
expect(getElement('.k-media-viewer')).not.to.eql(null);
|
|
764
|
+
expect((_getElement = getElement('.k-media-viewer-title')) == null ? void 0 : _getElement.textContent).to.contain('cover.png');
|
|
765
|
+
case 12:
|
|
766
|
+
case "end":
|
|
767
|
+
return _context40.stop();
|
|
768
|
+
}
|
|
769
|
+
}, _callee20);
|
|
770
|
+
})));
|
|
771
|
+
// 显式音频媒体未传 mask 插槽时,loading 文案和进度仍由 FileCard 层展示。
|
|
772
|
+
it('should render audio loading status and progress without mask slot', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
|
|
773
|
+
var _element$querySelecto13, _element$querySelecto14;
|
|
774
|
+
var Demo, _mount21, element;
|
|
775
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context42) {
|
|
776
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
777
|
+
case 0:
|
|
778
|
+
Demo = /*#__PURE__*/function (_Component21) {
|
|
779
|
+
_inheritsLoose(Demo, _Component21);
|
|
780
|
+
function Demo() {
|
|
781
|
+
var _context41;
|
|
782
|
+
var _this21;
|
|
783
|
+
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
|
784
|
+
args[_key21] = arguments[_key21];
|
|
785
|
+
}
|
|
786
|
+
_this21 = _Component21.call.apply(_Component21, _concatInstanceProperty(_context41 = [this]).call(_context41, args)) || this;
|
|
787
|
+
_this21.FileCard = FileCard;
|
|
788
|
+
return _this21;
|
|
789
|
+
}
|
|
790
|
+
return Demo;
|
|
791
|
+
}(Component);
|
|
792
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"voice.mp3\"\n type=\"audio\"\n status=\"loading\"\n loadingText=\"\u4E0A\u4F20\u4E2D\"\n percent={37}\n src=\"https://example.com/voice.mp3\"\n />\n </div>\n ";
|
|
793
|
+
_mount21 = mount(Demo), element = _mount21[1];
|
|
794
|
+
expect(element.querySelector('.k-media-loading-indicator')).not.to.eql(null);
|
|
795
|
+
expect((_element$querySelecto13 = element.querySelector('.k-file-card-media-loading-text')) == null ? void 0 : _element$querySelecto13.textContent).to.contain('上传中');
|
|
796
|
+
expect((_element$querySelecto14 = element.querySelector('.k-file-card-media-progress-text')) == null ? void 0 : _element$querySelecto14.textContent).to.contain('37%');
|
|
797
|
+
expect(element.querySelector('.k-media-preview-trigger')).to.eql(null);
|
|
798
|
+
case 7:
|
|
799
|
+
case "end":
|
|
800
|
+
return _context42.stop();
|
|
801
|
+
}
|
|
802
|
+
}, _callee21);
|
|
803
|
+
})));
|
|
804
|
+
// 小尺寸媒体卡片不展示居中的 loading 文案。
|
|
805
|
+
it('should hide loading text in compact image and video cards', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
|
|
806
|
+
var Demo, _mount22, element;
|
|
807
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context44) {
|
|
808
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
809
|
+
case 0:
|
|
810
|
+
Demo = /*#__PURE__*/function (_Component22) {
|
|
811
|
+
_inheritsLoose(Demo, _Component22);
|
|
812
|
+
function Demo() {
|
|
813
|
+
var _context43;
|
|
814
|
+
var _this22;
|
|
815
|
+
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
|
816
|
+
args[_key22] = arguments[_key22];
|
|
817
|
+
}
|
|
818
|
+
_this22 = _Component22.call.apply(_Component22, _concatInstanceProperty(_context43 = [this]).call(_context43, args)) || this;
|
|
819
|
+
_this22.FileCard = FileCard;
|
|
820
|
+
return _this22;
|
|
821
|
+
}
|
|
822
|
+
return Demo;
|
|
823
|
+
}(Component);
|
|
824
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"cover.png\"\n type=\"image\"\n size=\"small\"\n status=\"loading\"\n src=\"https://example.com/cover.png\"\n />\n <FileCard\n name=\"clip.mp4\"\n type=\"video\"\n size=\"mini\"\n status=\"loading\"\n src=\"https://example.com/clip.mp4\"\n />\n </div>\n ";
|
|
825
|
+
_mount22 = mount(Demo), element = _mount22[1];
|
|
826
|
+
expect(element.querySelectorAll('.k-file-card-media-loading-text').length).to.eql(0);
|
|
827
|
+
expect(getElement('.k-tooltip-content')).to.not.exist;
|
|
828
|
+
case 5:
|
|
829
|
+
case "end":
|
|
830
|
+
return _context44.stop();
|
|
831
|
+
}
|
|
832
|
+
}, _callee22);
|
|
833
|
+
})));
|
|
834
|
+
// 音频 error 文案仅在指定 errorText 时展示,mini 尺寸不展示文案。
|
|
835
|
+
it('should render audio error artwork when errorText is specified and hide text in mini size', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
|
|
836
|
+
var _cards$0$querySelecto3;
|
|
837
|
+
var Demo, _mount23, element, cards, artwork, icon;
|
|
838
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context46) {
|
|
839
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
840
|
+
case 0:
|
|
841
|
+
Demo = /*#__PURE__*/function (_Component23) {
|
|
842
|
+
_inheritsLoose(Demo, _Component23);
|
|
843
|
+
function Demo() {
|
|
844
|
+
var _context45;
|
|
845
|
+
var _this23;
|
|
846
|
+
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
|
847
|
+
args[_key23] = arguments[_key23];
|
|
848
|
+
}
|
|
849
|
+
_this23 = _Component23.call.apply(_Component23, _concatInstanceProperty(_context45 = [this]).call(_context45, args)) || this;
|
|
850
|
+
_this23.FileCard = FileCard;
|
|
851
|
+
return _this23;
|
|
852
|
+
}
|
|
853
|
+
return Demo;
|
|
854
|
+
}(Component);
|
|
855
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"voice.mp3\"\n type=\"audio\"\n status=\"error\"\n errorText=\"\u4E0A\u4F20\u5931\u8D25\"\n src=\"https://example.com/voice.mp3\"\n />\n <FileCard\n name=\"voice-mini.mp3\"\n type=\"audio\"\n size=\"mini\"\n status=\"error\"\n errorText=\"\u4E0A\u4F20\u5931\u8D25\"\n src=\"https://example.com/voice-mini.mp3\"\n />\n </div>\n ";
|
|
856
|
+
_mount23 = mount(Demo), element = _mount23[1];
|
|
857
|
+
cards = element.querySelectorAll('.k-file-card');
|
|
858
|
+
artwork = cards[0].querySelector('.k-file-card-media-error-artwork-content');
|
|
859
|
+
icon = artwork.querySelector('.k-file-card-media-error-artwork-icon');
|
|
860
|
+
expect((_cards$0$querySelecto3 = cards[0].querySelector('.k-file-card-error-text')) == null ? void 0 : _cards$0$querySelecto3.textContent).to.contain('上传失败');
|
|
861
|
+
expect(getComputedStyle(artwork).gap).to.eql('4px');
|
|
862
|
+
expect(cards[0].querySelector('.k-file-card-media-status-layer')).to.eql(null);
|
|
863
|
+
expect(cards[0].className).to.contain('k-file-card-media-error-artwork');
|
|
864
|
+
expect(icon.src).to.contain('ECECEC');
|
|
865
|
+
expect(cards[1].querySelector('.k-file-card-error-text')).to.eql(null);
|
|
866
|
+
expect(cards[1].querySelector('.k-file-card-media-error-artwork-content')).to.eql(null);
|
|
867
|
+
case 13:
|
|
868
|
+
case "end":
|
|
869
|
+
return _context46.stop();
|
|
870
|
+
}
|
|
871
|
+
}, _callee23);
|
|
872
|
+
})));
|
|
873
|
+
// 删除按钮位于右上角外侧,并阻止触发卡片点击。
|
|
874
|
+
it('should render corner delete button and trigger delete only', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24() {
|
|
875
|
+
var calls, Demo, _mount24, element, button, style;
|
|
876
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context48) {
|
|
877
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
878
|
+
case 0:
|
|
879
|
+
calls = [];
|
|
880
|
+
Demo = /*#__PURE__*/function (_Component24) {
|
|
881
|
+
_inheritsLoose(Demo, _Component24);
|
|
882
|
+
function Demo() {
|
|
883
|
+
var _context47;
|
|
884
|
+
var _this24;
|
|
885
|
+
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
|
886
|
+
args[_key24] = arguments[_key24];
|
|
887
|
+
}
|
|
888
|
+
_this24 = _Component24.call.apply(_Component24, _concatInstanceProperty(_context47 = [this]).call(_context47, args)) || this;
|
|
889
|
+
_this24.FileCard = FileCard;
|
|
890
|
+
_this24.onClick = function () {
|
|
891
|
+
calls.push('click');
|
|
892
|
+
};
|
|
893
|
+
_this24.onDelete = function () {
|
|
894
|
+
calls.push('delete');
|
|
895
|
+
};
|
|
896
|
+
return _this24;
|
|
897
|
+
}
|
|
898
|
+
return Demo;
|
|
899
|
+
}(Component);
|
|
900
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"spec.pdf\"\n showDelIcon\n ev-click={this.onClick}\n ev-delete={this.onDelete}\n />\n </div>\n ";
|
|
901
|
+
_mount24 = mount(Demo), element = _mount24[1];
|
|
902
|
+
button = element.querySelector('.k-file-card-delete');
|
|
903
|
+
style = getComputedStyle(button);
|
|
904
|
+
button.click();
|
|
905
|
+
_context48.next = 9;
|
|
906
|
+
return wait();
|
|
907
|
+
case 9:
|
|
908
|
+
expect(button.tagName).to.eql('DIV');
|
|
909
|
+
expect(button.className).not.to.contain('k-btn');
|
|
910
|
+
expect(style.top).to.eql('2px');
|
|
911
|
+
expect(style.right).to.eql('2px');
|
|
912
|
+
expect(style.transform).to.eql('none');
|
|
913
|
+
expect(calls).to.eql(['delete']);
|
|
914
|
+
case 15:
|
|
915
|
+
case "end":
|
|
916
|
+
return _context48.stop();
|
|
917
|
+
}
|
|
918
|
+
}, _callee24);
|
|
919
|
+
})));
|
|
920
|
+
// 媒体预览由内部 Media 负责,同时 FileCard 继续抛出 preview 事件。
|
|
921
|
+
it('should preview media through Media viewer and trigger preview event', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25() {
|
|
922
|
+
var _getElement2;
|
|
923
|
+
var Demo, _mount25, instance, element, previewTrigger;
|
|
924
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context50) {
|
|
925
|
+
while (1) switch (_context50.prev = _context50.next) {
|
|
926
|
+
case 0:
|
|
927
|
+
Demo = /*#__PURE__*/function (_Component25) {
|
|
928
|
+
_inheritsLoose(Demo, _Component25);
|
|
929
|
+
function Demo() {
|
|
930
|
+
var _context49;
|
|
931
|
+
var _this25;
|
|
932
|
+
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
|
933
|
+
args[_key25] = arguments[_key25];
|
|
934
|
+
}
|
|
935
|
+
_this25 = _Component25.call.apply(_Component25, _concatInstanceProperty(_context49 = [this]).call(_context49, args)) || this;
|
|
936
|
+
_this25.FileCard = FileCard;
|
|
937
|
+
return _this25;
|
|
938
|
+
}
|
|
939
|
+
Demo.defaults = function defaults() {
|
|
940
|
+
return {
|
|
941
|
+
previewCount: 0
|
|
942
|
+
};
|
|
943
|
+
};
|
|
944
|
+
return Demo;
|
|
945
|
+
}(Component);
|
|
946
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard\n name=\"cover.png\"\n type=\"image\"\n status=\"done\"\n src=\"https://example.com/cover.png\"\n ev-preview={() => this.set('previewCount', this.get('previewCount') + 1)}\n />\n </div>\n ";
|
|
947
|
+
_mount25 = mount(Demo), instance = _mount25[0], element = _mount25[1];
|
|
948
|
+
previewTrigger = element.querySelector('.k-media-preview-trigger');
|
|
949
|
+
previewTrigger.click();
|
|
950
|
+
_context50.next = 7;
|
|
951
|
+
return wait();
|
|
952
|
+
case 7:
|
|
953
|
+
expect(instance.get('previewCount')).to.eql(1);
|
|
954
|
+
expect(getElement('.k-media-viewer')).not.to.eql(null);
|
|
955
|
+
expect((_getElement2 = getElement('.k-media-viewer-title')) == null ? void 0 : _getElement2.textContent).to.contain('cover.png');
|
|
956
|
+
case 10:
|
|
957
|
+
case "end":
|
|
958
|
+
return _context50.stop();
|
|
959
|
+
}
|
|
960
|
+
}, _callee25);
|
|
961
|
+
})));
|
|
962
|
+
// showPreview=false 会同步关闭显式媒体和文件行媒体缩略图的预览入口。
|
|
963
|
+
it('should disable preview for media and file media thumbnail', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26() {
|
|
964
|
+
var Demo, _mount26, element;
|
|
965
|
+
return _regeneratorRuntime.wrap(function _callee26$(_context52) {
|
|
966
|
+
while (1) switch (_context52.prev = _context52.next) {
|
|
967
|
+
case 0:
|
|
968
|
+
Demo = /*#__PURE__*/function (_Component26) {
|
|
969
|
+
_inheritsLoose(Demo, _Component26);
|
|
970
|
+
function Demo() {
|
|
971
|
+
var _context51;
|
|
972
|
+
var _this26;
|
|
973
|
+
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
|
974
|
+
args[_key26] = arguments[_key26];
|
|
975
|
+
}
|
|
976
|
+
_this26 = _Component26.call.apply(_Component26, _concatInstanceProperty(_context51 = [this]).call(_context51, args)) || this;
|
|
977
|
+
_this26.FileCard = FileCard;
|
|
978
|
+
return _this26;
|
|
979
|
+
}
|
|
980
|
+
return Demo;
|
|
981
|
+
}(Component);
|
|
982
|
+
Demo.template = "\n const { FileCard } = this;\n <div>\n <FileCard name=\"cover.png\" type=\"image\" status=\"done\" showPreview={false} src=\"https://example.com/cover.png\" />\n <FileCard name=\"clip.mp4\" type=\"file\" showPreview={false} src=\"https://example.com/clip.mp4\" />\n </div>\n ";
|
|
983
|
+
_mount26 = mount(Demo), element = _mount26[1];
|
|
984
|
+
expect(element.querySelector('.k-media-preview-trigger')).to.eql(null);
|
|
985
|
+
case 4:
|
|
986
|
+
case "end":
|
|
987
|
+
return _context52.stop();
|
|
988
|
+
}
|
|
989
|
+
}, _callee26);
|
|
990
|
+
})));
|
|
991
|
+
// FileCardList 继承默认尺寸、删除开关,并透传新增的 loadingText。
|
|
992
|
+
it('should proxy FileCardList props and events', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
|
|
993
|
+
var _element$querySelecto15;
|
|
994
|
+
var calls, Demo, _mount27, element, card, button;
|
|
995
|
+
return _regeneratorRuntime.wrap(function _callee27$(_context54) {
|
|
996
|
+
while (1) switch (_context54.prev = _context54.next) {
|
|
997
|
+
case 0:
|
|
998
|
+
calls = [];
|
|
999
|
+
Demo = /*#__PURE__*/function (_Component27) {
|
|
1000
|
+
_inheritsLoose(Demo, _Component27);
|
|
1001
|
+
function Demo() {
|
|
1002
|
+
var _context53;
|
|
1003
|
+
var _this27;
|
|
1004
|
+
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
|
1005
|
+
args[_key27] = arguments[_key27];
|
|
1006
|
+
}
|
|
1007
|
+
_this27 = _Component27.call.apply(_Component27, _concatInstanceProperty(_context53 = [this]).call(_context53, args)) || this;
|
|
1008
|
+
_this27.FileCardList = FileCardList;
|
|
1009
|
+
_this27.onDelete = function (item) {
|
|
1010
|
+
calls.push(item.key);
|
|
1011
|
+
};
|
|
1012
|
+
return _this27;
|
|
1013
|
+
}
|
|
1014
|
+
return Demo;
|
|
1015
|
+
}(Component);
|
|
1016
|
+
Demo.template = "\n const { FileCardList } = this;\n <FileCardList\n size=\"small\"\n deleteable\n items={[\n {key: 'a', name: 'a.pdf', status: 'loading', percent: 10, loadingText: '\u4E0A\u4F20\u4E2D'},\n ]}\n ev-delete={this.onDelete}\n />\n ";
|
|
1017
|
+
_mount27 = mount(Demo), element = _mount27[1];
|
|
1018
|
+
card = element.querySelector('.k-file-card');
|
|
1019
|
+
button = element.querySelector('.k-file-card-delete');
|
|
1020
|
+
expect(card.className).to.contain('k-file-card-small');
|
|
1021
|
+
expect((_element$querySelecto15 = element.querySelector('.k-file-card-description')) == null ? void 0 : _element$querySelecto15.textContent).to.contain('上传中... 10%');
|
|
1022
|
+
button.click();
|
|
1023
|
+
_context54.next = 11;
|
|
1024
|
+
return wait();
|
|
1025
|
+
case 11:
|
|
1026
|
+
expect(calls).to.eql(['a']);
|
|
1027
|
+
case 12:
|
|
1028
|
+
case "end":
|
|
1029
|
+
return _context54.stop();
|
|
1030
|
+
}
|
|
1031
|
+
}, _callee27);
|
|
1032
|
+
})));
|
|
1033
|
+
// FileCardList 的 extension 插槽为空时,不保留额外 flex item。
|
|
1034
|
+
it('should not render extension wrapper when extension slot is empty', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
|
|
1035
|
+
var Demo, _mount28, element;
|
|
1036
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context56) {
|
|
1037
|
+
while (1) switch (_context56.prev = _context56.next) {
|
|
1038
|
+
case 0:
|
|
1039
|
+
Demo = /*#__PURE__*/function (_Component28) {
|
|
1040
|
+
_inheritsLoose(Demo, _Component28);
|
|
1041
|
+
function Demo() {
|
|
1042
|
+
var _context55;
|
|
1043
|
+
var _this28;
|
|
1044
|
+
for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {
|
|
1045
|
+
args[_key28] = arguments[_key28];
|
|
1046
|
+
}
|
|
1047
|
+
_this28 = _Component28.call.apply(_Component28, _concatInstanceProperty(_context55 = [this]).call(_context55, args)) || this;
|
|
1048
|
+
_this28.FileCardList = FileCardList;
|
|
1049
|
+
return _this28;
|
|
1050
|
+
}
|
|
1051
|
+
return Demo;
|
|
1052
|
+
}(Component);
|
|
1053
|
+
Demo.template = "\n const { FileCardList } = this;\n <FileCardList\n items={[{key: 'a', name: 'a.pdf'}]}\n >\n <b:extension>\n <button v-if={false} class=\"empty-extension\" type=\"button\">add</button>\n </b:extension>\n </FileCardList>\n ";
|
|
1054
|
+
_mount28 = mount(Demo), element = _mount28[1];
|
|
1055
|
+
expect(element.querySelector('.k-file-card-list-extension')).to.eql(null);
|
|
1056
|
+
case 4:
|
|
1057
|
+
case "end":
|
|
1058
|
+
return _context56.stop();
|
|
1059
|
+
}
|
|
1060
|
+
}, _callee28);
|
|
1061
|
+
})));
|
|
1062
|
+
// 删除角标回到卡片内后,列表容器不再需要额外顶部留白。
|
|
1063
|
+
it('should not add top padding for delete icon in lists', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {
|
|
1064
|
+
var Demo, _mount29, element, listWrap, listX, listY;
|
|
1065
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context58) {
|
|
1066
|
+
while (1) switch (_context58.prev = _context58.next) {
|
|
1067
|
+
case 0:
|
|
1068
|
+
Demo = /*#__PURE__*/function (_Component29) {
|
|
1069
|
+
_inheritsLoose(Demo, _Component29);
|
|
1070
|
+
function Demo() {
|
|
1071
|
+
var _context57;
|
|
1072
|
+
var _this29;
|
|
1073
|
+
for (var _len29 = arguments.length, args = new Array(_len29), _key29 = 0; _key29 < _len29; _key29++) {
|
|
1074
|
+
args[_key29] = arguments[_key29];
|
|
1075
|
+
}
|
|
1076
|
+
_this29 = _Component29.call.apply(_Component29, _concatInstanceProperty(_context57 = [this]).call(_context57, args)) || this;
|
|
1077
|
+
_this29.FileCardList = FileCardList;
|
|
1078
|
+
return _this29;
|
|
1079
|
+
}
|
|
1080
|
+
return Demo;
|
|
1081
|
+
}(Component);
|
|
1082
|
+
Demo.template = "\n const { FileCardList } = this;\n <div>\n <FileCardList\n className=\"wrap-list\"\n overflow=\"wrap\"\n deleteable\n items={[\n {key: 'c', name: 'c.pdf', type: 'file'},\n ]}\n />\n <FileCardList\n className=\"scroll-x-list\"\n overflow=\"scrollX\"\n deleteable\n items={[\n {key: 'a', name: 'a.pdf', type: 'file'},\n ]}\n />\n <FileCardList\n className=\"scroll-y-list\"\n overflow=\"scrollY\"\n deleteable\n items={[\n {key: 'b', name: 'b.pdf', type: 'file'},\n ]}\n />\n </div>\n ";
|
|
1083
|
+
_mount29 = mount(Demo), element = _mount29[1];
|
|
1084
|
+
listWrap = element.querySelector('.wrap-list');
|
|
1085
|
+
listX = element.querySelector('.scroll-x-list');
|
|
1086
|
+
listY = element.querySelector('.scroll-y-list');
|
|
1087
|
+
expect(getComputedStyle(listWrap).paddingTop).to.eql('0px');
|
|
1088
|
+
expect(getComputedStyle(listX).paddingTop).to.eql('0px');
|
|
1089
|
+
expect(getComputedStyle(listY).paddingTop).to.eql('0px');
|
|
1090
|
+
case 9:
|
|
1091
|
+
case "end":
|
|
1092
|
+
return _context58.stop();
|
|
1093
|
+
}
|
|
1094
|
+
}, _callee29);
|
|
1095
|
+
})));
|
|
1096
|
+
});
|