@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,771 @@
|
|
|
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 _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
6
|
+
import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js/instance/starts-with";
|
|
7
|
+
import { Component } from 'intact-vue-next';
|
|
8
|
+
import { mount, unmount, wait } from '../../test/utils';
|
|
9
|
+
import { Bubble } from '.';
|
|
10
|
+
describe('Bubble', function () {
|
|
11
|
+
afterEach(function () {
|
|
12
|
+
unmount();
|
|
13
|
+
});
|
|
14
|
+
it('should render placement, avatar and role name', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
15
|
+
var Demo, _mount, instance, element, bubbles, endMeta, endHeader, middleMeta;
|
|
16
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
17
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
20
|
+
_inheritsLoose(Demo, _Component);
|
|
21
|
+
function Demo() {
|
|
22
|
+
var _context;
|
|
23
|
+
var _this;
|
|
24
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
+
args[_key] = arguments[_key];
|
|
26
|
+
}
|
|
27
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
28
|
+
_this.Bubble = Bubble;
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
return Demo;
|
|
32
|
+
}(Component);
|
|
33
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble avatar={true} roleName=\"\u52A9\u624B\" content=\"hello\" />\n <Bubble placement=\"end\" avatar={true} roleName=\"\u6211\" content=\"world\" variant=\"outlined\" />\n <Bubble placement=\"middle\" avatar={false} content=\"system\" variant=\"plain\" />\n </div>\n ";
|
|
34
|
+
_mount = mount(Demo), instance = _mount[0], element = _mount[1];
|
|
35
|
+
bubbles = element.querySelectorAll('.k-bubble');
|
|
36
|
+
expect(bubbles.length).to.eql(3);
|
|
37
|
+
expect(bubbles[0].classList.contains('k-bubble-start')).to.be.true;
|
|
38
|
+
expect(bubbles[0].querySelector('.k-bubble-avatar')).not.to.eql(null);
|
|
39
|
+
expect(bubbles[0].querySelector('.k-bubble-header').textContent).to.contain('助手');
|
|
40
|
+
expect(bubbles[1].classList.contains('k-bubble-end')).to.be.true;
|
|
41
|
+
expect(bubbles[1].classList.contains('k-bubble-outlined')).to.be.true;
|
|
42
|
+
expect(bubbles[2].classList.contains('k-bubble-middle')).to.be.true;
|
|
43
|
+
expect(bubbles[2].classList.contains('k-bubble-plain')).to.be.true;
|
|
44
|
+
endMeta = bubbles[1].querySelector('.k-bubble-meta');
|
|
45
|
+
endHeader = bubbles[1].querySelector('.k-bubble-header');
|
|
46
|
+
middleMeta = bubbles[2].querySelector('.k-bubble-meta');
|
|
47
|
+
expect(getComputedStyle(endMeta).flexDirection).to.eql('row-reverse');
|
|
48
|
+
expect(getComputedStyle(endHeader).textAlign).to.eql('right');
|
|
49
|
+
expect(middleMeta).to.eql(null);
|
|
50
|
+
case 18:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context2.stop();
|
|
53
|
+
}
|
|
54
|
+
}, _callee);
|
|
55
|
+
})));
|
|
56
|
+
it('should mirror corner shape by placement', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
57
|
+
var Demo, _mount2, element, contents;
|
|
58
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context4) {
|
|
59
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
Demo = /*#__PURE__*/function (_Component2) {
|
|
62
|
+
_inheritsLoose(Demo, _Component2);
|
|
63
|
+
function Demo() {
|
|
64
|
+
var _context3;
|
|
65
|
+
var _this2;
|
|
66
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
67
|
+
args[_key2] = arguments[_key2];
|
|
68
|
+
}
|
|
69
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context3 = [this]).call(_context3, args)) || this;
|
|
70
|
+
_this2.Bubble = Bubble;
|
|
71
|
+
return _this2;
|
|
72
|
+
}
|
|
73
|
+
return Demo;
|
|
74
|
+
}(Component);
|
|
75
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble shape=\"corner\" placement=\"start\" content=\"left\" />\n <Bubble shape=\"corner\" placement=\"end\" content=\"right\" />\n <Bubble shape=\"corner\" placement=\"middle\" content=\"center\" />\n </div>\n ";
|
|
76
|
+
_mount2 = mount(Demo), element = _mount2[1];
|
|
77
|
+
contents = element.querySelectorAll('.k-bubble-content');
|
|
78
|
+
expect(getComputedStyle(contents[0]).borderBottomLeftRadius).to.eql('0px');
|
|
79
|
+
expect(getComputedStyle(contents[0]).borderBottomRightRadius).not.to.eql('0px');
|
|
80
|
+
expect(getComputedStyle(contents[1]).borderBottomRightRadius).to.eql('0px');
|
|
81
|
+
expect(getComputedStyle(contents[1]).borderBottomLeftRadius).not.to.eql('0px');
|
|
82
|
+
expect(getComputedStyle(contents[2]).borderBottomLeftRadius).not.to.eql('0px');
|
|
83
|
+
expect(getComputedStyle(contents[2]).borderBottomRightRadius).not.to.eql('0px');
|
|
84
|
+
case 10:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context4.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee2);
|
|
89
|
+
})));
|
|
90
|
+
it('should render loading state', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
91
|
+
var Demo, _mount3, instance, element;
|
|
92
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context6) {
|
|
93
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
Demo = /*#__PURE__*/function (_Component3) {
|
|
96
|
+
_inheritsLoose(Demo, _Component3);
|
|
97
|
+
function Demo() {
|
|
98
|
+
var _context5;
|
|
99
|
+
var _this3;
|
|
100
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
101
|
+
args[_key3] = arguments[_key3];
|
|
102
|
+
}
|
|
103
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context5 = [this]).call(_context5, args)) || this;
|
|
104
|
+
_this3.Bubble = Bubble;
|
|
105
|
+
return _this3;
|
|
106
|
+
}
|
|
107
|
+
Demo.defaults = function defaults() {
|
|
108
|
+
return {
|
|
109
|
+
loading: true
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
return Demo;
|
|
113
|
+
}(Component);
|
|
114
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble loading={this.get('loading')} content=\"\u6B63\u5728\u751F\u6210\u4E2D\" />\n </div>\n ";
|
|
115
|
+
_mount3 = mount(Demo), instance = _mount3[0], element = _mount3[1];
|
|
116
|
+
_context6.next = 5;
|
|
117
|
+
return wait(40);
|
|
118
|
+
case 5:
|
|
119
|
+
expect(element.querySelector('.k-bubble-loading')).not.to.eql(null);
|
|
120
|
+
instance.set('loading', false);
|
|
121
|
+
_context6.next = 9;
|
|
122
|
+
return wait();
|
|
123
|
+
case 9:
|
|
124
|
+
expect(element.querySelector('.k-bubble-loading')).to.eql(null);
|
|
125
|
+
case 10:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context6.stop();
|
|
128
|
+
}
|
|
129
|
+
}, _callee3);
|
|
130
|
+
})));
|
|
131
|
+
it('should only render footer when custom footer slot is provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
132
|
+
var Demo, _mount4, instance, element, footers;
|
|
133
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context8) {
|
|
134
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
135
|
+
case 0:
|
|
136
|
+
Demo = /*#__PURE__*/function (_Component4) {
|
|
137
|
+
_inheritsLoose(Demo, _Component4);
|
|
138
|
+
function Demo() {
|
|
139
|
+
var _context7;
|
|
140
|
+
var _this4;
|
|
141
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
142
|
+
args[_key4] = arguments[_key4];
|
|
143
|
+
}
|
|
144
|
+
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context7 = [this]).call(_context7, args)) || this;
|
|
145
|
+
_this4.Bubble = Bubble;
|
|
146
|
+
return _this4;
|
|
147
|
+
}
|
|
148
|
+
return Demo;
|
|
149
|
+
}(Component);
|
|
150
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble content=\"no footer\" />\n <Bubble content=\"custom footer\">\n <b:footer>\n <span class=\"custom-footer\">custom</span>\n </b:footer>\n </Bubble>\n </div>\n ";
|
|
151
|
+
_mount4 = mount(Demo), instance = _mount4[0], element = _mount4[1];
|
|
152
|
+
footers = element.querySelectorAll('.k-bubble-footer');
|
|
153
|
+
expect(footers.length).to.eql(1);
|
|
154
|
+
expect(element.querySelector('.custom-footer').textContent).to.eql('custom');
|
|
155
|
+
case 6:
|
|
156
|
+
case "end":
|
|
157
|
+
return _context8.stop();
|
|
158
|
+
}
|
|
159
|
+
}, _callee4);
|
|
160
|
+
})));
|
|
161
|
+
it('should keep custom footer visible during loading and typing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
162
|
+
var Demo, _mount5, instance, element;
|
|
163
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context10) {
|
|
164
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
165
|
+
case 0:
|
|
166
|
+
Demo = /*#__PURE__*/function (_Component5) {
|
|
167
|
+
_inheritsLoose(Demo, _Component5);
|
|
168
|
+
function Demo() {
|
|
169
|
+
var _context9;
|
|
170
|
+
var _this5;
|
|
171
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
172
|
+
args[_key5] = arguments[_key5];
|
|
173
|
+
}
|
|
174
|
+
_this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context9 = [this]).call(_context9, args)) || this;
|
|
175
|
+
_this5.Bubble = Bubble;
|
|
176
|
+
return _this5;
|
|
177
|
+
}
|
|
178
|
+
return Demo;
|
|
179
|
+
}(Component);
|
|
180
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble loading={true} content=\"custom footer\">\n <b:footer>\n <span class=\"custom-loading-footer\">stop</span>\n </b:footer>\n </Bubble>\n <Bubble typing={true} content=\"typing footer\">\n <b:footer>\n <span class=\"custom-typing-footer\">typing</span>\n </b:footer>\n </Bubble>\n </div>\n ";
|
|
181
|
+
_mount5 = mount(Demo), instance = _mount5[0], element = _mount5[1];
|
|
182
|
+
expect(element.querySelector('.custom-loading-footer').textContent).to.eql('stop');
|
|
183
|
+
expect(element.querySelector('.custom-typing-footer').textContent).to.eql('typing');
|
|
184
|
+
case 5:
|
|
185
|
+
case "end":
|
|
186
|
+
return _context10.stop();
|
|
187
|
+
}
|
|
188
|
+
}, _callee5);
|
|
189
|
+
})));
|
|
190
|
+
it('should render footer when footer slot is provided without content', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
191
|
+
var Demo, _mount6, element;
|
|
192
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context12) {
|
|
193
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
194
|
+
case 0:
|
|
195
|
+
Demo = /*#__PURE__*/function (_Component6) {
|
|
196
|
+
_inheritsLoose(Demo, _Component6);
|
|
197
|
+
function Demo() {
|
|
198
|
+
var _context11;
|
|
199
|
+
var _this6;
|
|
200
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
201
|
+
args[_key6] = arguments[_key6];
|
|
202
|
+
}
|
|
203
|
+
_this6 = _Component6.call.apply(_Component6, _concatInstanceProperty(_context11 = [this]).call(_context11, args)) || this;
|
|
204
|
+
_this6.Bubble = Bubble;
|
|
205
|
+
return _this6;
|
|
206
|
+
}
|
|
207
|
+
return Demo;
|
|
208
|
+
}(Component);
|
|
209
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble>\n <b:footer>\n <span class=\"custom-footer-only\">footer only</span>\n </b:footer>\n </Bubble>\n </div>\n ";
|
|
210
|
+
_mount6 = mount(Demo), element = _mount6[1];
|
|
211
|
+
expect(element.querySelector('.k-bubble')).not.to.eql(null);
|
|
212
|
+
expect(element.querySelector('.k-bubble-content')).to.eql(null);
|
|
213
|
+
expect(element.querySelector('.custom-footer-only').textContent).to.eql('footer only');
|
|
214
|
+
case 6:
|
|
215
|
+
case "end":
|
|
216
|
+
return _context12.stop();
|
|
217
|
+
}
|
|
218
|
+
}, _callee6);
|
|
219
|
+
})));
|
|
220
|
+
it('should not render wrappers for empty conditional slots', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
221
|
+
var Demo, _mount7, instance, element;
|
|
222
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context14) {
|
|
223
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
224
|
+
case 0:
|
|
225
|
+
Demo = /*#__PURE__*/function (_Component7) {
|
|
226
|
+
_inheritsLoose(Demo, _Component7);
|
|
227
|
+
function Demo() {
|
|
228
|
+
var _context13;
|
|
229
|
+
var _this7;
|
|
230
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
231
|
+
args[_key7] = arguments[_key7];
|
|
232
|
+
}
|
|
233
|
+
_this7 = _Component7.call.apply(_Component7, _concatInstanceProperty(_context13 = [this]).call(_context13, args)) || this;
|
|
234
|
+
_this7.Bubble = Bubble;
|
|
235
|
+
return _this7;
|
|
236
|
+
}
|
|
237
|
+
Demo.defaults = function defaults() {
|
|
238
|
+
return {
|
|
239
|
+
showSlot: false
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
return Demo;
|
|
243
|
+
}(Component);
|
|
244
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble content=\"main content\">\n <b:beforeContent>\n <span v-if={this.get('showSlot')} class=\"conditional-before-content\">before</span>\n </b:beforeContent>\n <b:attachments>\n <span v-if={this.get('showSlot')} class=\"conditional-attachments\">attachments</span>\n </b:attachments>\n <b:bottom>\n <span v-if={this.get('showSlot')} class=\"conditional-bottom\">bottom</span>\n </b:bottom>\n <b:footer>\n <span v-if={this.get('showSlot')} class=\"conditional-footer\">footer</span>\n </b:footer>\n <b:extra>\n <span v-if={this.get('showSlot')} class=\"conditional-extra\">extra</span>\n </b:extra>\n </Bubble>\n </div>\n ";
|
|
245
|
+
_mount7 = mount(Demo), instance = _mount7[0], element = _mount7[1];
|
|
246
|
+
expect(element.querySelector('.k-bubble-before-content')).to.eql(null);
|
|
247
|
+
expect(element.querySelector('.k-bubble-attachments')).to.eql(null);
|
|
248
|
+
expect(element.querySelector('.k-bubble-bottom')).to.eql(null);
|
|
249
|
+
expect(element.querySelector('.k-bubble-footer')).to.eql(null);
|
|
250
|
+
expect(element.querySelector('.k-bubble-extra')).to.eql(null);
|
|
251
|
+
expect(element.querySelector('.k-bubble-text').textContent).to.contain('main content');
|
|
252
|
+
instance.set('showSlot', true);
|
|
253
|
+
_context14.next = 12;
|
|
254
|
+
return wait();
|
|
255
|
+
case 12:
|
|
256
|
+
expect(element.querySelector('.conditional-before-content').textContent).to.eql('before');
|
|
257
|
+
expect(element.querySelector('.conditional-attachments').textContent).to.eql('attachments');
|
|
258
|
+
expect(element.querySelector('.conditional-bottom').textContent).to.eql('bottom');
|
|
259
|
+
expect(element.querySelector('.conditional-footer').textContent).to.eql('footer');
|
|
260
|
+
expect(element.querySelector('.conditional-extra').textContent).to.eql('extra');
|
|
261
|
+
case 17:
|
|
262
|
+
case "end":
|
|
263
|
+
return _context14.stop();
|
|
264
|
+
}
|
|
265
|
+
}, _callee7);
|
|
266
|
+
})));
|
|
267
|
+
it('should fallback to default loading when custom loading slot is empty', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
268
|
+
var Demo, _mount8, instance, element;
|
|
269
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context16) {
|
|
270
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
271
|
+
case 0:
|
|
272
|
+
Demo = /*#__PURE__*/function (_Component8) {
|
|
273
|
+
_inheritsLoose(Demo, _Component8);
|
|
274
|
+
function Demo() {
|
|
275
|
+
var _context15;
|
|
276
|
+
var _this8;
|
|
277
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
278
|
+
args[_key8] = arguments[_key8];
|
|
279
|
+
}
|
|
280
|
+
_this8 = _Component8.call.apply(_Component8, _concatInstanceProperty(_context15 = [this]).call(_context15, args)) || this;
|
|
281
|
+
_this8.Bubble = Bubble;
|
|
282
|
+
return _this8;
|
|
283
|
+
}
|
|
284
|
+
Demo.defaults = function defaults() {
|
|
285
|
+
return {
|
|
286
|
+
showLoadingSlot: false
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
return Demo;
|
|
290
|
+
}(Component);
|
|
291
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble loading={true}>\n <b:loading>\n <span v-if={this.get('showLoadingSlot')} class=\"custom-loading-slot\">loading</span>\n </b:loading>\n </Bubble>\n </div>\n ";
|
|
292
|
+
_mount8 = mount(Demo), instance = _mount8[0], element = _mount8[1];
|
|
293
|
+
expect(element.querySelector('.custom-loading-slot')).to.eql(null);
|
|
294
|
+
expect(element.querySelector('.k-bubble-loading')).not.to.eql(null);
|
|
295
|
+
instance.set('showLoadingSlot', true);
|
|
296
|
+
_context16.next = 8;
|
|
297
|
+
return wait();
|
|
298
|
+
case 8:
|
|
299
|
+
expect(element.querySelector('.custom-loading-slot').textContent).to.eql('loading');
|
|
300
|
+
expect(element.querySelector('.k-bubble-loading')).to.eql(null);
|
|
301
|
+
case 10:
|
|
302
|
+
case "end":
|
|
303
|
+
return _context16.stop();
|
|
304
|
+
}
|
|
305
|
+
}, _callee8);
|
|
306
|
+
})));
|
|
307
|
+
it('should render bottom inside bubble content and keep extra below footer', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
308
|
+
var Demo, _mount9, element, content, text, bottom, footer, extra;
|
|
309
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context18) {
|
|
310
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
311
|
+
case 0:
|
|
312
|
+
Demo = /*#__PURE__*/function (_Component9) {
|
|
313
|
+
_inheritsLoose(Demo, _Component9);
|
|
314
|
+
function Demo() {
|
|
315
|
+
var _context17;
|
|
316
|
+
var _this9;
|
|
317
|
+
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
|
318
|
+
args[_key9] = arguments[_key9];
|
|
319
|
+
}
|
|
320
|
+
_this9 = _Component9.call.apply(_Component9, _concatInstanceProperty(_context17 = [this]).call(_context17, args)) || this;
|
|
321
|
+
_this9.Bubble = Bubble;
|
|
322
|
+
return _this9;
|
|
323
|
+
}
|
|
324
|
+
return Demo;
|
|
325
|
+
}(Component);
|
|
326
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble content=\"main content\">\n <b:bottom>\n <div class=\"custom-bubble-bottom\">bottom</div>\n </b:bottom>\n <b:footer>\n <div class=\"custom-bubble-footer-order\">footer</div>\n </b:footer>\n <b:extra>\n <div class=\"custom-bubble-extra-order\">extra</div>\n </b:extra>\n </Bubble>\n </div>\n ";
|
|
327
|
+
_mount9 = mount(Demo), element = _mount9[1];
|
|
328
|
+
content = element.querySelector('.k-bubble-content');
|
|
329
|
+
text = element.querySelector('.k-bubble-text');
|
|
330
|
+
bottom = element.querySelector('.custom-bubble-bottom');
|
|
331
|
+
footer = element.querySelector('.custom-bubble-footer-order');
|
|
332
|
+
extra = element.querySelector('.custom-bubble-extra-order');
|
|
333
|
+
expect(content.contains(bottom)).to.be.true;
|
|
334
|
+
expect(text.compareDocumentPosition(bottom) & Node.DOCUMENT_POSITION_FOLLOWING).to.not.eql(0);
|
|
335
|
+
expect(footer.compareDocumentPosition(extra) & Node.DOCUMENT_POSITION_FOLLOWING).to.not.eql(0);
|
|
336
|
+
case 11:
|
|
337
|
+
case "end":
|
|
338
|
+
return _context18.stop();
|
|
339
|
+
}
|
|
340
|
+
}, _callee9);
|
|
341
|
+
})));
|
|
342
|
+
it('should not render bubble when content is empty and loading is false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
343
|
+
var Demo, _mount10, instance, element;
|
|
344
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context20) {
|
|
345
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
346
|
+
case 0:
|
|
347
|
+
Demo = /*#__PURE__*/function (_Component10) {
|
|
348
|
+
_inheritsLoose(Demo, _Component10);
|
|
349
|
+
function Demo() {
|
|
350
|
+
var _context19;
|
|
351
|
+
var _this10;
|
|
352
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
353
|
+
args[_key10] = arguments[_key10];
|
|
354
|
+
}
|
|
355
|
+
_this10 = _Component10.call.apply(_Component10, _concatInstanceProperty(_context19 = [this]).call(_context19, args)) || this;
|
|
356
|
+
_this10.Bubble = Bubble;
|
|
357
|
+
return _this10;
|
|
358
|
+
}
|
|
359
|
+
return Demo;
|
|
360
|
+
}(Component);
|
|
361
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble content=\"\" />\n </div>\n ";
|
|
362
|
+
_mount10 = mount(Demo), instance = _mount10[0], element = _mount10[1];
|
|
363
|
+
expect(element.querySelector('.k-bubble')).to.eql(null);
|
|
364
|
+
case 4:
|
|
365
|
+
case "end":
|
|
366
|
+
return _context20.stop();
|
|
367
|
+
}
|
|
368
|
+
}, _callee10);
|
|
369
|
+
})));
|
|
370
|
+
it('should render beforeContent slot without showing empty bubble content', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
371
|
+
var Demo, _mount11, instance, element;
|
|
372
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context22) {
|
|
373
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
374
|
+
case 0:
|
|
375
|
+
Demo = /*#__PURE__*/function (_Component11) {
|
|
376
|
+
_inheritsLoose(Demo, _Component11);
|
|
377
|
+
function Demo() {
|
|
378
|
+
var _context21;
|
|
379
|
+
var _this11;
|
|
380
|
+
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
|
381
|
+
args[_key11] = arguments[_key11];
|
|
382
|
+
}
|
|
383
|
+
_this11 = _Component11.call.apply(_Component11, _concatInstanceProperty(_context21 = [this]).call(_context21, args)) || this;
|
|
384
|
+
_this11.Bubble = Bubble;
|
|
385
|
+
return _this11;
|
|
386
|
+
}
|
|
387
|
+
return Demo;
|
|
388
|
+
}(Component);
|
|
389
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble avatar={true} roleName=\"AI \u52A9\u624B\" content=\"\">\n <b:beforeContent>\n <div class=\"bubble-before-content\">thinking</div>\n </b:beforeContent>\n </Bubble>\n </div>\n ";
|
|
390
|
+
_mount11 = mount(Demo), instance = _mount11[0], element = _mount11[1];
|
|
391
|
+
expect(element.querySelector('.k-bubble')).not.to.eql(null);
|
|
392
|
+
expect(element.querySelector('.bubble-before-content').textContent).to.eql('thinking');
|
|
393
|
+
expect(element.querySelector('.k-bubble-content')).to.eql(null);
|
|
394
|
+
case 6:
|
|
395
|
+
case "end":
|
|
396
|
+
return _context22.stop();
|
|
397
|
+
}
|
|
398
|
+
}, _callee11);
|
|
399
|
+
})));
|
|
400
|
+
it('should render attachments slot inside bubble content before text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
401
|
+
var Demo, _mount12, instance, element, attachments, text;
|
|
402
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context24) {
|
|
403
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
404
|
+
case 0:
|
|
405
|
+
Demo = /*#__PURE__*/function (_Component12) {
|
|
406
|
+
_inheritsLoose(Demo, _Component12);
|
|
407
|
+
function Demo() {
|
|
408
|
+
var _context23;
|
|
409
|
+
var _this12;
|
|
410
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
|
411
|
+
args[_key12] = arguments[_key12];
|
|
412
|
+
}
|
|
413
|
+
_this12 = _Component12.call.apply(_Component12, _concatInstanceProperty(_context23 = [this]).call(_context23, args)) || this;
|
|
414
|
+
_this12.Bubble = Bubble;
|
|
415
|
+
return _this12;
|
|
416
|
+
}
|
|
417
|
+
return Demo;
|
|
418
|
+
}(Component);
|
|
419
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble content=\"\u9644\u4EF6\u8BF4\u660E\">\n <b:attachments>\n <div class=\"bubble-attachments-slot\">attachments</div>\n </b:attachments>\n </Bubble>\n </div>\n ";
|
|
420
|
+
_mount12 = mount(Demo), instance = _mount12[0], element = _mount12[1];
|
|
421
|
+
attachments = element.querySelector('.k-bubble-attachments');
|
|
422
|
+
text = element.querySelector('.k-bubble-text');
|
|
423
|
+
expect(attachments).not.to.eql(null);
|
|
424
|
+
expect(attachments.textContent).to.contain('attachments');
|
|
425
|
+
expect(text).not.to.eql(null);
|
|
426
|
+
expect(text.textContent).to.contain('附件说明');
|
|
427
|
+
expect(attachments.compareDocumentPosition(text) & Node.DOCUMENT_POSITION_FOLLOWING).to.not.eql(0);
|
|
428
|
+
case 10:
|
|
429
|
+
case "end":
|
|
430
|
+
return _context24.stop();
|
|
431
|
+
}
|
|
432
|
+
}, _callee12);
|
|
433
|
+
})));
|
|
434
|
+
it('should keep custom slot content constrained inside bubble content width', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
435
|
+
var Demo, _mount13, element, content, customSlot;
|
|
436
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context26) {
|
|
437
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
438
|
+
case 0:
|
|
439
|
+
Demo = /*#__PURE__*/function (_Component13) {
|
|
440
|
+
_inheritsLoose(Demo, _Component13);
|
|
441
|
+
function Demo() {
|
|
442
|
+
var _context25;
|
|
443
|
+
var _this13;
|
|
444
|
+
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
|
445
|
+
args[_key13] = arguments[_key13];
|
|
446
|
+
}
|
|
447
|
+
_this13 = _Component13.call.apply(_Component13, _concatInstanceProperty(_context25 = [this]).call(_context25, args)) || this;
|
|
448
|
+
_this13.Bubble = Bubble;
|
|
449
|
+
return _this13;
|
|
450
|
+
}
|
|
451
|
+
return Demo;
|
|
452
|
+
}(Component);
|
|
453
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble maxWidthString=\"320px\">\n <b:content>\n <div class=\"bubble-custom-slot-width\">custom slot</div>\n </b:content>\n </Bubble>\n </div>\n ";
|
|
454
|
+
_mount13 = mount(Demo), element = _mount13[1];
|
|
455
|
+
content = element.querySelector('.k-bubble-content');
|
|
456
|
+
customSlot = element.querySelector('.bubble-custom-slot-width');
|
|
457
|
+
expect(getComputedStyle(content).maxWidth).to.eql('100%');
|
|
458
|
+
expect(getComputedStyle(customSlot).maxWidth).to.eql('100%');
|
|
459
|
+
expect(getComputedStyle(customSlot).minWidth).to.eql('0px');
|
|
460
|
+
case 8:
|
|
461
|
+
case "end":
|
|
462
|
+
return _context26.stop();
|
|
463
|
+
}
|
|
464
|
+
}, _callee13);
|
|
465
|
+
})));
|
|
466
|
+
it('should render bubble when only attachments slot is provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
467
|
+
var Demo, _mount14, instance, element;
|
|
468
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context28) {
|
|
469
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
470
|
+
case 0:
|
|
471
|
+
Demo = /*#__PURE__*/function (_Component14) {
|
|
472
|
+
_inheritsLoose(Demo, _Component14);
|
|
473
|
+
function Demo() {
|
|
474
|
+
var _context27;
|
|
475
|
+
var _this14;
|
|
476
|
+
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
|
477
|
+
args[_key14] = arguments[_key14];
|
|
478
|
+
}
|
|
479
|
+
_this14 = _Component14.call.apply(_Component14, _concatInstanceProperty(_context27 = [this]).call(_context27, args)) || this;
|
|
480
|
+
_this14.Bubble = Bubble;
|
|
481
|
+
return _this14;
|
|
482
|
+
}
|
|
483
|
+
return Demo;
|
|
484
|
+
}(Component);
|
|
485
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble content=\"\">\n <b:attachments>\n <div class=\"bubble-attachments-only\">files only</div>\n </b:attachments>\n </Bubble>\n </div>\n ";
|
|
486
|
+
_mount14 = mount(Demo), instance = _mount14[0], element = _mount14[1];
|
|
487
|
+
expect(element.querySelector('.k-bubble')).not.to.eql(null);
|
|
488
|
+
expect(element.querySelector('.bubble-attachments-only').textContent).to.eql('files only');
|
|
489
|
+
expect(element.querySelector('.k-bubble-text')).to.eql(null);
|
|
490
|
+
case 6:
|
|
491
|
+
case "end":
|
|
492
|
+
return _context28.stop();
|
|
493
|
+
}
|
|
494
|
+
}, _callee14);
|
|
495
|
+
})));
|
|
496
|
+
it('should restart typing from empty after loading resets a reused bubble', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
|
|
497
|
+
var Demo, _mount15, instance, element, text;
|
|
498
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context30) {
|
|
499
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
500
|
+
case 0:
|
|
501
|
+
Demo = /*#__PURE__*/function (_Component15) {
|
|
502
|
+
_inheritsLoose(Demo, _Component15);
|
|
503
|
+
function Demo() {
|
|
504
|
+
var _context29;
|
|
505
|
+
var _this15;
|
|
506
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
|
507
|
+
args[_key15] = arguments[_key15];
|
|
508
|
+
}
|
|
509
|
+
_this15 = _Component15.call.apply(_Component15, _concatInstanceProperty(_context29 = [this]).call(_context29, args)) || this;
|
|
510
|
+
_this15.Bubble = Bubble;
|
|
511
|
+
return _this15;
|
|
512
|
+
}
|
|
513
|
+
Demo.defaults = function defaults() {
|
|
514
|
+
return {
|
|
515
|
+
loading: false,
|
|
516
|
+
content: 'old content'
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
return Demo;
|
|
520
|
+
}(Component);
|
|
521
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble\n loading={this.get('loading')}\n typing={{interval: 16, step: 2}}\n content={this.get('content')}\n />\n </div>\n ";
|
|
522
|
+
_mount15 = mount(Demo), instance = _mount15[0], element = _mount15[1];
|
|
523
|
+
_context30.next = 5;
|
|
524
|
+
return wait(120);
|
|
525
|
+
case 5:
|
|
526
|
+
instance.set({
|
|
527
|
+
loading: true,
|
|
528
|
+
content: 'new round'
|
|
529
|
+
});
|
|
530
|
+
_context30.next = 8;
|
|
531
|
+
return wait();
|
|
532
|
+
case 8:
|
|
533
|
+
instance.set('loading', false);
|
|
534
|
+
_context30.next = 11;
|
|
535
|
+
return wait(40);
|
|
536
|
+
case 11:
|
|
537
|
+
text = element.querySelector('.k-bubble-text').textContent;
|
|
538
|
+
expect(text.length).to.be.greaterThan(0);
|
|
539
|
+
expect(text.length).to.be.lessThan('new round'.length);
|
|
540
|
+
expect(text).not.to.eql('new round');
|
|
541
|
+
case 15:
|
|
542
|
+
case "end":
|
|
543
|
+
return _context30.stop();
|
|
544
|
+
}
|
|
545
|
+
}, _callee15);
|
|
546
|
+
})));
|
|
547
|
+
it('should keep the loading shell mounted between loading finish and the first streaming chunk', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
548
|
+
var Demo, _mount16, instance, element, bubble;
|
|
549
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context32) {
|
|
550
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
551
|
+
case 0:
|
|
552
|
+
Demo = /*#__PURE__*/function (_Component16) {
|
|
553
|
+
_inheritsLoose(Demo, _Component16);
|
|
554
|
+
function Demo() {
|
|
555
|
+
var _context31;
|
|
556
|
+
var _this16;
|
|
557
|
+
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
|
558
|
+
args[_key16] = arguments[_key16];
|
|
559
|
+
}
|
|
560
|
+
_this16 = _Component16.call.apply(_Component16, _concatInstanceProperty(_context31 = [this]).call(_context31, args)) || this;
|
|
561
|
+
_this16.Bubble = Bubble;
|
|
562
|
+
return _this16;
|
|
563
|
+
}
|
|
564
|
+
Demo.defaults = function defaults() {
|
|
565
|
+
return {
|
|
566
|
+
loading: true,
|
|
567
|
+
streaming: false,
|
|
568
|
+
content: ''
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
return Demo;
|
|
572
|
+
}(Component);
|
|
573
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble\n loading={this.get('loading')}\n streaming={this.get('streaming')}\n typing={{interval: 16, step: 2}}\n content={this.get('content')}\n />\n </div>\n ";
|
|
574
|
+
_mount16 = mount(Demo), instance = _mount16[0], element = _mount16[1];
|
|
575
|
+
bubble = element.querySelector('.k-bubble');
|
|
576
|
+
expect(bubble).not.to.eql(null);
|
|
577
|
+
expect(element.querySelector('.k-bubble-loading')).not.to.eql(null);
|
|
578
|
+
instance.set({
|
|
579
|
+
loading: false,
|
|
580
|
+
streaming: true
|
|
581
|
+
});
|
|
582
|
+
_context32.next = 9;
|
|
583
|
+
return wait();
|
|
584
|
+
case 9:
|
|
585
|
+
expect(element.querySelector('.k-bubble')).to.eql(bubble);
|
|
586
|
+
expect(element.querySelector('.k-bubble-loading')).not.to.eql(null);
|
|
587
|
+
instance.set('content', 'ab');
|
|
588
|
+
_context32.next = 14;
|
|
589
|
+
return wait(24);
|
|
590
|
+
case 14:
|
|
591
|
+
expect(element.querySelector('.k-bubble-loading')).to.eql(null);
|
|
592
|
+
expect(element.querySelector('.k-bubble-text').textContent).to.contain('ab');
|
|
593
|
+
case 16:
|
|
594
|
+
case "end":
|
|
595
|
+
return _context32.stop();
|
|
596
|
+
}
|
|
597
|
+
}, _callee16);
|
|
598
|
+
})));
|
|
599
|
+
it('should trigger typing events during animation and typingComplete once after streaming ends', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
|
|
600
|
+
var Demo, _mount17, instance;
|
|
601
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context34) {
|
|
602
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
603
|
+
case 0:
|
|
604
|
+
Demo = /*#__PURE__*/function (_Component17) {
|
|
605
|
+
_inheritsLoose(Demo, _Component17);
|
|
606
|
+
function Demo() {
|
|
607
|
+
var _context33;
|
|
608
|
+
var _this17;
|
|
609
|
+
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
|
610
|
+
args[_key17] = arguments[_key17];
|
|
611
|
+
}
|
|
612
|
+
_this17 = _Component17.call.apply(_Component17, _concatInstanceProperty(_context33 = [this]).call(_context33, args)) || this;
|
|
613
|
+
_this17.Bubble = Bubble;
|
|
614
|
+
return _this17;
|
|
615
|
+
}
|
|
616
|
+
Demo.defaults = function defaults() {
|
|
617
|
+
return {
|
|
618
|
+
content: '',
|
|
619
|
+
streaming: true,
|
|
620
|
+
typingCount: 0,
|
|
621
|
+
completeCount: 0,
|
|
622
|
+
completedContent: ''
|
|
623
|
+
};
|
|
624
|
+
};
|
|
625
|
+
return Demo;
|
|
626
|
+
}(Component);
|
|
627
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble\n content={this.get('content')}\n streaming={this.get('streaming')}\n typing={{interval: 16, step: 2}}\n ev-typing={() => this.set('typingCount', this.get('typingCount') + 1)}\n ev-typingComplete={(content) => this.set({\n completeCount: this.get('completeCount') + 1,\n completedContent: content,\n })}\n />\n </div>\n ";
|
|
628
|
+
_mount17 = mount(Demo), instance = _mount17[0];
|
|
629
|
+
instance.set('content', 'abcd');
|
|
630
|
+
_context34.next = 6;
|
|
631
|
+
return wait(80);
|
|
632
|
+
case 6:
|
|
633
|
+
expect(instance.get('typingCount')).to.be.greaterThan(0);
|
|
634
|
+
expect(instance.get('completeCount')).to.eql(0);
|
|
635
|
+
instance.set('content', 'abcdef');
|
|
636
|
+
_context34.next = 11;
|
|
637
|
+
return wait(80);
|
|
638
|
+
case 11:
|
|
639
|
+
expect(instance.get('completeCount')).to.eql(0);
|
|
640
|
+
instance.set('streaming', false);
|
|
641
|
+
_context34.next = 15;
|
|
642
|
+
return wait(24);
|
|
643
|
+
case 15:
|
|
644
|
+
expect(instance.get('completeCount')).to.eql(1);
|
|
645
|
+
expect(instance.get('completedContent')).to.eql('abcdef');
|
|
646
|
+
case 17:
|
|
647
|
+
case "end":
|
|
648
|
+
return _context34.stop();
|
|
649
|
+
}
|
|
650
|
+
}, _callee17);
|
|
651
|
+
})));
|
|
652
|
+
it('should trigger typingComplete when a loading round finishes with empty content', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
|
|
653
|
+
var Demo, _mount18, instance;
|
|
654
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context36) {
|
|
655
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
656
|
+
case 0:
|
|
657
|
+
Demo = /*#__PURE__*/function (_Component18) {
|
|
658
|
+
_inheritsLoose(Demo, _Component18);
|
|
659
|
+
function Demo() {
|
|
660
|
+
var _context35;
|
|
661
|
+
var _this18;
|
|
662
|
+
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
|
663
|
+
args[_key18] = arguments[_key18];
|
|
664
|
+
}
|
|
665
|
+
_this18 = _Component18.call.apply(_Component18, _concatInstanceProperty(_context35 = [this]).call(_context35, args)) || this;
|
|
666
|
+
_this18.Bubble = Bubble;
|
|
667
|
+
return _this18;
|
|
668
|
+
}
|
|
669
|
+
Demo.defaults = function defaults() {
|
|
670
|
+
return {
|
|
671
|
+
loading: true,
|
|
672
|
+
completeCount: 0,
|
|
673
|
+
completedContent: 'not-empty'
|
|
674
|
+
};
|
|
675
|
+
};
|
|
676
|
+
return Demo;
|
|
677
|
+
}(Component);
|
|
678
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble\n loading={this.get('loading')}\n content=\"\"\n ev-typingComplete={(content) => this.set({\n completeCount: this.get('completeCount') + 1,\n completedContent: content,\n })}\n />\n </div>\n ";
|
|
679
|
+
_mount18 = mount(Demo), instance = _mount18[0];
|
|
680
|
+
instance.set('loading', false);
|
|
681
|
+
_context36.next = 6;
|
|
682
|
+
return wait();
|
|
683
|
+
case 6:
|
|
684
|
+
expect(instance.get('completeCount')).to.eql(1);
|
|
685
|
+
expect(instance.get('completedContent')).to.eql('');
|
|
686
|
+
case 8:
|
|
687
|
+
case "end":
|
|
688
|
+
return _context36.stop();
|
|
689
|
+
}
|
|
690
|
+
}, _callee18);
|
|
691
|
+
})));
|
|
692
|
+
it('should keep the shared prefix when streaming content is revised', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
|
|
693
|
+
var Demo, _mount19, instance, element, firstText, i, nextText, _i;
|
|
694
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context38) {
|
|
695
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
696
|
+
case 0:
|
|
697
|
+
Demo = /*#__PURE__*/function (_Component19) {
|
|
698
|
+
_inheritsLoose(Demo, _Component19);
|
|
699
|
+
function Demo() {
|
|
700
|
+
var _context37;
|
|
701
|
+
var _this19;
|
|
702
|
+
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
|
703
|
+
args[_key19] = arguments[_key19];
|
|
704
|
+
}
|
|
705
|
+
_this19 = _Component19.call.apply(_Component19, _concatInstanceProperty(_context37 = [this]).call(_context37, args)) || this;
|
|
706
|
+
_this19.Bubble = Bubble;
|
|
707
|
+
return _this19;
|
|
708
|
+
}
|
|
709
|
+
Demo.defaults = function defaults() {
|
|
710
|
+
return {
|
|
711
|
+
content: 'hello world',
|
|
712
|
+
streaming: true
|
|
713
|
+
};
|
|
714
|
+
};
|
|
715
|
+
return Demo;
|
|
716
|
+
}(Component);
|
|
717
|
+
Demo.template = "\n const { Bubble } = this;\n <div>\n <Bubble\n content={this.get('content')}\n streaming={this.get('streaming')}\n typing={{interval: 16, step: 2}}\n />\n </div>\n ";
|
|
718
|
+
_mount19 = mount(Demo), instance = _mount19[0], element = _mount19[1];
|
|
719
|
+
firstText = '';
|
|
720
|
+
i = 0;
|
|
721
|
+
case 5:
|
|
722
|
+
if (!(i < 8)) {
|
|
723
|
+
_context38.next = 14;
|
|
724
|
+
break;
|
|
725
|
+
}
|
|
726
|
+
_context38.next = 8;
|
|
727
|
+
return wait(20);
|
|
728
|
+
case 8:
|
|
729
|
+
firstText = element.querySelector('.k-bubble-text').textContent || '';
|
|
730
|
+
if (!_includesInstanceProperty(firstText).call(firstText, 'hello')) {
|
|
731
|
+
_context38.next = 11;
|
|
732
|
+
break;
|
|
733
|
+
}
|
|
734
|
+
return _context38.abrupt("break", 14);
|
|
735
|
+
case 11:
|
|
736
|
+
i++;
|
|
737
|
+
_context38.next = 5;
|
|
738
|
+
break;
|
|
739
|
+
case 14:
|
|
740
|
+
expect(firstText).to.contain('hello');
|
|
741
|
+
instance.set('content', 'hello, world');
|
|
742
|
+
nextText = '';
|
|
743
|
+
_i = 0;
|
|
744
|
+
case 18:
|
|
745
|
+
if (!(_i < 6)) {
|
|
746
|
+
_context38.next = 27;
|
|
747
|
+
break;
|
|
748
|
+
}
|
|
749
|
+
_context38.next = 21;
|
|
750
|
+
return wait(20);
|
|
751
|
+
case 21:
|
|
752
|
+
nextText = element.querySelector('.k-bubble-text').textContent || '';
|
|
753
|
+
if (!_startsWithInstanceProperty(nextText).call(nextText, 'hello')) {
|
|
754
|
+
_context38.next = 24;
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
return _context38.abrupt("break", 27);
|
|
758
|
+
case 24:
|
|
759
|
+
_i++;
|
|
760
|
+
_context38.next = 18;
|
|
761
|
+
break;
|
|
762
|
+
case 27:
|
|
763
|
+
expect(_startsWithInstanceProperty(nextText).call(nextText, 'hello')).to.be.true;
|
|
764
|
+
expect(nextText).not.to.eql('');
|
|
765
|
+
case 29:
|
|
766
|
+
case "end":
|
|
767
|
+
return _context38.stop();
|
|
768
|
+
}
|
|
769
|
+
}, _callee19);
|
|
770
|
+
})));
|
|
771
|
+
});
|