@king-design/vue 3.8.0-beta.0 → 3.8.0-beta.2
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 +74 -74
- package/components/bubble/bubble.d.ts +3 -0
- package/components/bubble/bubble.vdt.js +6 -2
- package/components/bubble/index.spec.js +231 -5
- package/components/bubble/styles.js +1 -1
- package/components/bubble/useBubbleDisplay.d.ts +1 -0
- package/components/bubble/useBubbleDisplay.js +68 -22
- package/components/bubbleList/bubbleList.vdt.js +3 -1
- package/components/bubbleList/index.spec.js +378 -237
- package/components/bubbleList/styles.js +2 -2
- package/components/bubbleList/useBubbleList.js +7 -0
- package/components/fileCard/fileCard.vdt.js +4 -4
- package/components/fileCard/index.spec.js +179 -107
- package/components/fileCard/list.d.ts +2 -1
- package/components/fileCard/list.vdt.js +7 -5
- package/components/fileCard/styles.js +10 -8
- package/components/fileCard/useFileCard.d.ts +1 -1
- package/components/fileCard/useFileCard.js +6 -35
- package/components/media/index.spec.js +774 -585
- package/components/media/media.vdt.js +17 -6
- package/components/media/mediaAssets.d.ts +2 -0
- package/components/media/mediaAssets.js +4 -0
- package/components/media/styles.js +5 -3
- package/components/media/useMedia.d.ts +6 -2
- package/components/media/useMedia.js +28 -6
- package/components/sender/index.spec.js +1146 -476
- package/components/sender/sender.d.ts +28 -5
- package/components/sender/sender.js +17 -6
- package/components/sender/sender.vdt.js +121 -49
- package/components/sender/styles.js +18 -9
- package/components/sender/useAutoResize.js +7 -6
- package/components/sender/useSenderDrag.js +12 -3
- package/components/sender/useSenderInput.d.ts +3 -0
- package/components/sender/useSenderInput.js +20 -3
- package/components/sender/useSenderPaste.js +1 -1
- package/components/sender/useSenderUpload.js +38 -29
- package/components/xmarkdown/index.spec.js +492 -263
- package/components/xmarkdown/markdown/streaming.js +41 -8
- package/components/xmarkdown/styles.js +2 -2
- package/components/xmarkdown/useXMarkdownDisplay.d.ts +1 -0
- package/components/xmarkdown/useXMarkdownDisplay.js +69 -24
- package/components/xmarkdown/xmarkdown.d.ts +3 -0
- package/components/xmarkdown/xmarkdown.vdt.js +6 -2
- package/dist/i18n/en-US.js +1 -0
- package/dist/i18n/en-US.js.map +1 -1
- package/dist/i18n/en-US.min.js +1 -1
- package/dist/index.js +795 -512
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/i18n/en-US.d.ts +1 -0
- package/i18n/en-US.js +1 -0
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
|
7
7
|
import _Array$from from "@babel/runtime-corejs3/core-js/array/from";
|
|
8
8
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
|
|
9
9
|
import _atInstanceProperty from "@babel/runtime-corejs3/core-js/instance/at";
|
|
10
|
+
import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js/instance/starts-with";
|
|
10
11
|
import { Component } from 'intact-vue-next';
|
|
11
12
|
import { dispatchEvent, mount, unmount, wait } from '../../test/utils';
|
|
12
13
|
import { BubbleList } from '.';
|
|
@@ -513,8 +514,8 @@ describe('BubbleList', function () {
|
|
|
513
514
|
}
|
|
514
515
|
}, _callee8);
|
|
515
516
|
})));
|
|
516
|
-
it('should scroll
|
|
517
|
-
var Demo, _mount9, instance, element, scrollBox,
|
|
517
|
+
it('should keep scroll content flush and add gap only when scrollbar appears', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
518
|
+
var Demo, _mount9, instance, element, scrollBox, scrollContent, contentStyle;
|
|
518
519
|
return _regeneratorRuntime.wrap(function _callee9$(_context30) {
|
|
519
520
|
while (1) switch (_context30.prev = _context30.next) {
|
|
520
521
|
case 0:
|
|
@@ -527,7 +528,6 @@ describe('BubbleList', function () {
|
|
|
527
528
|
args[_key9] = arguments[_key9];
|
|
528
529
|
}
|
|
529
530
|
_this9 = _Component9.call.apply(_Component9, _concatInstanceProperty(_context28 = [this]).call(_context28, args)) || this;
|
|
530
|
-
_this9.listRef = null;
|
|
531
531
|
_this9.BubbleList = BubbleList;
|
|
532
532
|
return _this9;
|
|
533
533
|
}
|
|
@@ -535,38 +535,50 @@ describe('BubbleList', function () {
|
|
|
535
535
|
var _context29;
|
|
536
536
|
return {
|
|
537
537
|
items: _mapInstanceProperty(_context29 = _Array$from({
|
|
538
|
-
length:
|
|
538
|
+
length: 6
|
|
539
539
|
})).call(_context29, function (_, index) {
|
|
540
540
|
return {
|
|
541
|
-
key: index
|
|
542
|
-
content: "row-" +
|
|
541
|
+
key: index,
|
|
542
|
+
content: "row-" + index
|
|
543
543
|
};
|
|
544
544
|
})
|
|
545
545
|
};
|
|
546
546
|
};
|
|
547
547
|
return Demo;
|
|
548
548
|
}(Component);
|
|
549
|
-
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n
|
|
549
|
+
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n style=\"height: 120px;\"\n items={this.get('items')}\n >\n <b:item args=\"scope\">\n <div class=\"scrollbar-gap-row\" style=\"height: 48px;\">{scope.item.content}</div>\n </b:item>\n </BubbleList>\n ";
|
|
550
550
|
_mount9 = mount(Demo), instance = _mount9[0], element = _mount9[1];
|
|
551
551
|
_context30.next = 5;
|
|
552
552
|
return wait(80);
|
|
553
553
|
case 5:
|
|
554
|
-
instance.listRef.scrollToKey(6, 'auto');
|
|
555
|
-
_context30.next = 8;
|
|
556
|
-
return wait(30);
|
|
557
|
-
case 8:
|
|
558
554
|
scrollBox = element.querySelector('.k-bubble-list-scroll');
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
expect(
|
|
563
|
-
|
|
555
|
+
scrollContent = element.querySelector('.k-bubble-list-scroll-content');
|
|
556
|
+
contentStyle = getComputedStyle(scrollContent);
|
|
557
|
+
expect(scrollBox.scrollHeight).to.be.greaterThan(scrollBox.clientHeight);
|
|
558
|
+
expect(scrollBox.classList.contains('k-bubble-list-scroll-has-scrollbar')).to.be.true;
|
|
559
|
+
expect(getComputedStyle(scrollBox).paddingInlineEnd).to.eql('6px');
|
|
560
|
+
expect(contentStyle.paddingInlineStart).to.eql('0px');
|
|
561
|
+
expect(contentStyle.paddingInlineEnd).to.eql('0px');
|
|
562
|
+
instance.set('items', [{
|
|
563
|
+
key: 'short',
|
|
564
|
+
content: 'short'
|
|
565
|
+
}]);
|
|
566
|
+
_context30.next = 16;
|
|
567
|
+
return wait(120);
|
|
568
|
+
case 16:
|
|
569
|
+
contentStyle = getComputedStyle(scrollContent);
|
|
570
|
+
expect(scrollBox.scrollHeight - scrollBox.clientHeight).to.be.lessThan(2);
|
|
571
|
+
expect(scrollBox.classList.contains('k-bubble-list-scroll-has-scrollbar')).to.be.false;
|
|
572
|
+
expect(getComputedStyle(scrollBox).paddingInlineEnd).to.eql('0px');
|
|
573
|
+
expect(contentStyle.paddingInlineStart).to.eql('0px');
|
|
574
|
+
expect(contentStyle.paddingInlineEnd).to.eql('0px');
|
|
575
|
+
case 22:
|
|
564
576
|
case "end":
|
|
565
577
|
return _context30.stop();
|
|
566
578
|
}
|
|
567
579
|
}, _callee9);
|
|
568
580
|
})));
|
|
569
|
-
it('should scroll
|
|
581
|
+
it('should scroll correctly when using a custom item slot', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
570
582
|
var Demo, _mount10, instance, element, scrollBox, targetRow, scrollBoxRect, targetRect;
|
|
571
583
|
return _regeneratorRuntime.wrap(function _callee10$(_context33) {
|
|
572
584
|
while (1) switch (_context33.prev = _context33.next) {
|
|
@@ -587,25 +599,11 @@ describe('BubbleList', function () {
|
|
|
587
599
|
Demo.defaults = function defaults() {
|
|
588
600
|
var _context32;
|
|
589
601
|
return {
|
|
590
|
-
roles: {
|
|
591
|
-
ai: {
|
|
592
|
-
placement: 'start',
|
|
593
|
-
avatar: true,
|
|
594
|
-
roleName: 'AI'
|
|
595
|
-
},
|
|
596
|
-
user: {
|
|
597
|
-
placement: 'end',
|
|
598
|
-
avatar: true,
|
|
599
|
-
roleName: 'Me',
|
|
600
|
-
variant: 'outlined'
|
|
601
|
-
}
|
|
602
|
-
},
|
|
603
602
|
items: _mapInstanceProperty(_context32 = _Array$from({
|
|
604
603
|
length: 12
|
|
605
604
|
})).call(_context32, function (_, index) {
|
|
606
605
|
return {
|
|
607
606
|
key: index + 1,
|
|
608
|
-
role: index % 2 ? 'user' : 'ai',
|
|
609
607
|
content: "row-" + (index + 1)
|
|
610
608
|
};
|
|
611
609
|
})
|
|
@@ -613,7 +611,7 @@ describe('BubbleList', function () {
|
|
|
613
611
|
};
|
|
614
612
|
return Demo;
|
|
615
613
|
}(Component);
|
|
616
|
-
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n ref={(i) => this.listRef = i}\n style=\"height: 180px;\"\n items={this.get('items')}\n
|
|
614
|
+
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n ref={(i) => this.listRef = i}\n style=\"height: 180px;\"\n items={this.get('items')}\n >\n <b:item args=\"scope\">\n <div class=\"custom-item-shell\" style=\"height: 48px;\">{scope.item.content}</div>\n </b:item>\n </BubbleList>\n ";
|
|
617
615
|
_mount10 = mount(Demo), instance = _mount10[0], element = _mount10[1];
|
|
618
616
|
_context33.next = 5;
|
|
619
617
|
return wait(80);
|
|
@@ -623,7 +621,7 @@ describe('BubbleList', function () {
|
|
|
623
621
|
return wait(30);
|
|
624
622
|
case 8:
|
|
625
623
|
scrollBox = element.querySelector('.k-bubble-list-scroll');
|
|
626
|
-
targetRow = element.querySelectorAll('.
|
|
624
|
+
targetRow = element.querySelectorAll('.custom-item-shell')[5];
|
|
627
625
|
scrollBoxRect = scrollBox.getBoundingClientRect();
|
|
628
626
|
targetRect = targetRow.getBoundingClientRect();
|
|
629
627
|
expect(Math.abs(targetRect.top - scrollBoxRect.top)).to.be.lessThan(4);
|
|
@@ -633,7 +631,7 @@ describe('BubbleList', function () {
|
|
|
633
631
|
}
|
|
634
632
|
}, _callee10);
|
|
635
633
|
})));
|
|
636
|
-
it('should
|
|
634
|
+
it('should scroll the target item near the top when calling scrollToKey', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
637
635
|
var Demo, _mount11, instance, element, scrollBox, targetRow, scrollBoxRect, targetRect;
|
|
638
636
|
return _regeneratorRuntime.wrap(function _callee11$(_context36) {
|
|
639
637
|
while (1) switch (_context36.prev = _context36.next) {
|
|
@@ -671,7 +669,7 @@ describe('BubbleList', function () {
|
|
|
671
669
|
length: 12
|
|
672
670
|
})).call(_context35, function (_, index) {
|
|
673
671
|
return {
|
|
674
|
-
|
|
672
|
+
key: index + 1,
|
|
675
673
|
role: index % 2 ? 'user' : 'ai',
|
|
676
674
|
content: "row-" + (index + 1)
|
|
677
675
|
};
|
|
@@ -680,12 +678,12 @@ describe('BubbleList', function () {
|
|
|
680
678
|
};
|
|
681
679
|
return Demo;
|
|
682
680
|
}(Component);
|
|
683
|
-
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n ref={(i) => this.listRef = i}\n style=\"height: 180px;\"\n items={this.get('items')}\n
|
|
681
|
+
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n ref={(i) => this.listRef = i}\n style=\"height: 180px;\"\n items={this.get('items')}\n roles={this.get('roles')}\n />\n ";
|
|
684
682
|
_mount11 = mount(Demo), instance = _mount11[0], element = _mount11[1];
|
|
685
683
|
_context36.next = 5;
|
|
686
684
|
return wait(80);
|
|
687
685
|
case 5:
|
|
688
|
-
instance.listRef.scrollToKey(
|
|
686
|
+
instance.listRef.scrollToKey(6, 'auto');
|
|
689
687
|
_context36.next = 8;
|
|
690
688
|
return wait(30);
|
|
691
689
|
case 8:
|
|
@@ -700,11 +698,10 @@ describe('BubbleList', function () {
|
|
|
700
698
|
}
|
|
701
699
|
}, _callee11);
|
|
702
700
|
})));
|
|
703
|
-
it('should
|
|
704
|
-
var
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
while (1) switch (_context41.prev = _context41.next) {
|
|
701
|
+
it('should support resolving keys from itemKey function when scrolling to a message', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
702
|
+
var Demo, _mount12, instance, element, scrollBox, targetRow, scrollBoxRect, targetRect;
|
|
703
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context39) {
|
|
704
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
708
705
|
case 0:
|
|
709
706
|
Demo = /*#__PURE__*/function (_Component12) {
|
|
710
707
|
_inheritsLoose(Demo, _Component12);
|
|
@@ -715,9 +712,77 @@ describe('BubbleList', function () {
|
|
|
715
712
|
args[_key12] = arguments[_key12];
|
|
716
713
|
}
|
|
717
714
|
_this12 = _Component12.call.apply(_Component12, _concatInstanceProperty(_context37 = [this]).call(_context37, args)) || this;
|
|
715
|
+
_this12.listRef = null;
|
|
718
716
|
_this12.BubbleList = BubbleList;
|
|
719
717
|
return _this12;
|
|
720
718
|
}
|
|
719
|
+
Demo.defaults = function defaults() {
|
|
720
|
+
var _context38;
|
|
721
|
+
return {
|
|
722
|
+
roles: {
|
|
723
|
+
ai: {
|
|
724
|
+
placement: 'start',
|
|
725
|
+
avatar: true,
|
|
726
|
+
roleName: 'AI'
|
|
727
|
+
},
|
|
728
|
+
user: {
|
|
729
|
+
placement: 'end',
|
|
730
|
+
avatar: true,
|
|
731
|
+
roleName: 'Me',
|
|
732
|
+
variant: 'outlined'
|
|
733
|
+
}
|
|
734
|
+
},
|
|
735
|
+
items: _mapInstanceProperty(_context38 = _Array$from({
|
|
736
|
+
length: 12
|
|
737
|
+
})).call(_context38, function (_, index) {
|
|
738
|
+
return {
|
|
739
|
+
id: "msg-" + (index + 1),
|
|
740
|
+
role: index % 2 ? 'user' : 'ai',
|
|
741
|
+
content: "row-" + (index + 1)
|
|
742
|
+
};
|
|
743
|
+
})
|
|
744
|
+
};
|
|
745
|
+
};
|
|
746
|
+
return Demo;
|
|
747
|
+
}(Component);
|
|
748
|
+
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n ref={(i) => this.listRef = i}\n style=\"height: 180px;\"\n items={this.get('items')}\n itemKey={(item) => item.id}\n roles={this.get('roles')}\n />\n ";
|
|
749
|
+
_mount12 = mount(Demo), instance = _mount12[0], element = _mount12[1];
|
|
750
|
+
_context39.next = 5;
|
|
751
|
+
return wait(80);
|
|
752
|
+
case 5:
|
|
753
|
+
instance.listRef.scrollToKey('msg-6', 'auto');
|
|
754
|
+
_context39.next = 8;
|
|
755
|
+
return wait(30);
|
|
756
|
+
case 8:
|
|
757
|
+
scrollBox = element.querySelector('.k-bubble-list-scroll');
|
|
758
|
+
targetRow = element.querySelectorAll('.k-bubble-list-item')[5];
|
|
759
|
+
scrollBoxRect = scrollBox.getBoundingClientRect();
|
|
760
|
+
targetRect = targetRow.getBoundingClientRect();
|
|
761
|
+
expect(Math.abs(targetRect.top - scrollBoxRect.top)).to.be.lessThan(4);
|
|
762
|
+
case 13:
|
|
763
|
+
case "end":
|
|
764
|
+
return _context39.stop();
|
|
765
|
+
}
|
|
766
|
+
}, _callee12);
|
|
767
|
+
})));
|
|
768
|
+
it('should keep per-item slot updates working when list boundaries change', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
769
|
+
var _context41, _context42, _context43;
|
|
770
|
+
var Demo, _mount13, instance, element;
|
|
771
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context44) {
|
|
772
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
773
|
+
case 0:
|
|
774
|
+
Demo = /*#__PURE__*/function (_Component13) {
|
|
775
|
+
_inheritsLoose(Demo, _Component13);
|
|
776
|
+
function Demo() {
|
|
777
|
+
var _context40;
|
|
778
|
+
var _this13;
|
|
779
|
+
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
|
780
|
+
args[_key13] = arguments[_key13];
|
|
781
|
+
}
|
|
782
|
+
_this13 = _Component13.call.apply(_Component13, _concatInstanceProperty(_context40 = [this]).call(_context40, args)) || this;
|
|
783
|
+
_this13.BubbleList = BubbleList;
|
|
784
|
+
return _this13;
|
|
785
|
+
}
|
|
721
786
|
Demo.defaults = function defaults() {
|
|
722
787
|
return {
|
|
723
788
|
items: [{
|
|
@@ -732,54 +797,54 @@ describe('BubbleList', function () {
|
|
|
732
797
|
return Demo;
|
|
733
798
|
}(Component);
|
|
734
799
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList items={this.get('items')}>\n <b:footer args=\"scope\">\n <span class=\"last-flag\">{scope.item.key}:{scope.isLast ? 'last' : 'normal'}</span>\n </b:footer>\n </BubbleList>\n ";
|
|
735
|
-
|
|
736
|
-
|
|
800
|
+
_mount13 = mount(Demo), instance = _mount13[0], element = _mount13[1];
|
|
801
|
+
_context44.next = 5;
|
|
737
802
|
return wait(50);
|
|
738
803
|
case 5:
|
|
739
|
-
expect(_mapInstanceProperty(
|
|
804
|
+
expect(_mapInstanceProperty(_context41 = _Array$from(element.querySelectorAll('.last-flag'))).call(_context41, function (item) {
|
|
740
805
|
return item.textContent;
|
|
741
806
|
})).to.eql(['1:normal', '2:last']);
|
|
742
|
-
instance.set('items', _concatInstanceProperty(
|
|
807
|
+
instance.set('items', _concatInstanceProperty(_context42 = []).call(_context42, instance.get('items'), [{
|
|
743
808
|
key: 3,
|
|
744
809
|
content: 'third'
|
|
745
810
|
}]));
|
|
746
|
-
|
|
811
|
+
_context44.next = 9;
|
|
747
812
|
return wait(50);
|
|
748
813
|
case 9:
|
|
749
|
-
expect(_mapInstanceProperty(
|
|
814
|
+
expect(_mapInstanceProperty(_context43 = _Array$from(element.querySelectorAll('.last-flag'))).call(_context43, function (item) {
|
|
750
815
|
return item.textContent;
|
|
751
816
|
})).to.eql(['1:normal', '2:normal', '3:last']);
|
|
752
817
|
case 10:
|
|
753
818
|
case "end":
|
|
754
|
-
return
|
|
819
|
+
return _context44.stop();
|
|
755
820
|
}
|
|
756
|
-
},
|
|
821
|
+
}, _callee13);
|
|
757
822
|
})));
|
|
758
|
-
it('should trigger loadHistory once when scrolling near the top', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
759
|
-
var Demo,
|
|
760
|
-
return _regeneratorRuntime.wrap(function
|
|
761
|
-
while (1) switch (
|
|
823
|
+
it('should trigger loadHistory once when scrolling near the top', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
824
|
+
var Demo, _mount14, instance, element, scrollBox;
|
|
825
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context47) {
|
|
826
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
762
827
|
case 0:
|
|
763
|
-
Demo = /*#__PURE__*/function (
|
|
764
|
-
_inheritsLoose(Demo,
|
|
828
|
+
Demo = /*#__PURE__*/function (_Component14) {
|
|
829
|
+
_inheritsLoose(Demo, _Component14);
|
|
765
830
|
function Demo() {
|
|
766
|
-
var
|
|
767
|
-
var
|
|
768
|
-
for (var
|
|
769
|
-
args[
|
|
831
|
+
var _context45;
|
|
832
|
+
var _this14;
|
|
833
|
+
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
|
834
|
+
args[_key14] = arguments[_key14];
|
|
770
835
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
return
|
|
836
|
+
_this14 = _Component14.call.apply(_Component14, _concatInstanceProperty(_context45 = [this]).call(_context45, args)) || this;
|
|
837
|
+
_this14.BubbleList = BubbleList;
|
|
838
|
+
return _this14;
|
|
774
839
|
}
|
|
775
840
|
Demo.defaults = function defaults() {
|
|
776
|
-
var
|
|
841
|
+
var _context46;
|
|
777
842
|
return {
|
|
778
843
|
count: 0,
|
|
779
844
|
loadingHistory: false,
|
|
780
|
-
items: _mapInstanceProperty(
|
|
845
|
+
items: _mapInstanceProperty(_context46 = _Array$from({
|
|
781
846
|
length: 10
|
|
782
|
-
})).call(
|
|
847
|
+
})).call(_context46, function (_, index) {
|
|
783
848
|
return {
|
|
784
849
|
key: index,
|
|
785
850
|
content: "history-" + index
|
|
@@ -790,40 +855,40 @@ describe('BubbleList', function () {
|
|
|
790
855
|
return Demo;
|
|
791
856
|
}(Component);
|
|
792
857
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n style=\"height: 180px;\"\n items={this.get('items')}\n hasMoreHistory={true}\n loadingHistory={this.get('loadingHistory')}\n ev-loadHistory={() => this.set({count: this.get('count') + 1, loadingHistory: true})}\n >\n <b:item args=\"scope\">\n <div style=\"height: 44px;\">{scope.item.content}</div>\n </b:item>\n </BubbleList>\n ";
|
|
793
|
-
|
|
794
|
-
|
|
858
|
+
_mount14 = mount(Demo), instance = _mount14[0], element = _mount14[1];
|
|
859
|
+
_context47.next = 5;
|
|
795
860
|
return wait(80);
|
|
796
861
|
case 5:
|
|
797
862
|
scrollBox = element.querySelector('.k-bubble-list-scroll');
|
|
798
863
|
scrollBox.scrollTop = 0;
|
|
799
864
|
dispatchEvent(scrollBox, 'scroll');
|
|
800
865
|
dispatchEvent(scrollBox, 'scroll');
|
|
801
|
-
|
|
866
|
+
_context47.next = 11;
|
|
802
867
|
return wait(40);
|
|
803
868
|
case 11:
|
|
804
869
|
expect(instance.get('count')).to.eql(1);
|
|
805
870
|
case 12:
|
|
806
871
|
case "end":
|
|
807
|
-
return
|
|
872
|
+
return _context47.stop();
|
|
808
873
|
}
|
|
809
|
-
},
|
|
874
|
+
}, _callee14);
|
|
810
875
|
})));
|
|
811
|
-
it('should show the default history loading text only while loadingHistory is true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
812
|
-
var Demo,
|
|
813
|
-
return _regeneratorRuntime.wrap(function
|
|
814
|
-
while (1) switch (
|
|
876
|
+
it('should show the default history loading text only while loadingHistory is true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
|
|
877
|
+
var Demo, _mount15, instance, element;
|
|
878
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context49) {
|
|
879
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
815
880
|
case 0:
|
|
816
|
-
Demo = /*#__PURE__*/function (
|
|
817
|
-
_inheritsLoose(Demo,
|
|
881
|
+
Demo = /*#__PURE__*/function (_Component15) {
|
|
882
|
+
_inheritsLoose(Demo, _Component15);
|
|
818
883
|
function Demo() {
|
|
819
|
-
var
|
|
820
|
-
var
|
|
821
|
-
for (var
|
|
822
|
-
args[
|
|
884
|
+
var _context48;
|
|
885
|
+
var _this15;
|
|
886
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
|
887
|
+
args[_key15] = arguments[_key15];
|
|
823
888
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
return
|
|
889
|
+
_this15 = _Component15.call.apply(_Component15, _concatInstanceProperty(_context48 = [this]).call(_context48, args)) || this;
|
|
890
|
+
_this15.BubbleList = BubbleList;
|
|
891
|
+
return _this15;
|
|
827
892
|
}
|
|
828
893
|
Demo.defaults = function defaults() {
|
|
829
894
|
return {
|
|
@@ -837,46 +902,46 @@ describe('BubbleList', function () {
|
|
|
837
902
|
return Demo;
|
|
838
903
|
}(Component);
|
|
839
904
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n style=\"height: 180px;\"\n items={this.get('items')}\n loadingHistory={this.get('loadingHistory')}\n />\n ";
|
|
840
|
-
|
|
841
|
-
|
|
905
|
+
_mount15 = mount(Demo), instance = _mount15[0], element = _mount15[1];
|
|
906
|
+
_context49.next = 5;
|
|
842
907
|
return wait(50);
|
|
843
908
|
case 5:
|
|
844
909
|
expect(element.querySelector('.k-bubble-list-history')).to.be.null;
|
|
845
910
|
instance.set('loadingHistory', true);
|
|
846
|
-
|
|
911
|
+
_context49.next = 9;
|
|
847
912
|
return wait(50);
|
|
848
913
|
case 9:
|
|
849
914
|
expect(element.querySelector('.k-bubble-list-history span').textContent).to.eql('加载历史中...');
|
|
850
915
|
instance.set('loadingHistory', false);
|
|
851
|
-
|
|
916
|
+
_context49.next = 13;
|
|
852
917
|
return wait(50);
|
|
853
918
|
case 13:
|
|
854
919
|
expect(element.querySelector('.k-bubble-list-history')).to.be.null;
|
|
855
920
|
case 14:
|
|
856
921
|
case "end":
|
|
857
|
-
return
|
|
922
|
+
return _context49.stop();
|
|
858
923
|
}
|
|
859
|
-
},
|
|
924
|
+
}, _callee15);
|
|
860
925
|
})));
|
|
861
|
-
it('should warn only once when items are missing stable keys', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
926
|
+
it('should warn only once when items are missing stable keys', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
862
927
|
var warn, spy, Demo;
|
|
863
|
-
return _regeneratorRuntime.wrap(function
|
|
864
|
-
while (1) switch (
|
|
928
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context51) {
|
|
929
|
+
while (1) switch (_context51.prev = _context51.next) {
|
|
865
930
|
case 0:
|
|
866
931
|
warn = console.warn;
|
|
867
932
|
spy = sinon.spy();
|
|
868
933
|
console.warn = spy;
|
|
869
|
-
Demo = /*#__PURE__*/function (
|
|
870
|
-
_inheritsLoose(Demo,
|
|
934
|
+
Demo = /*#__PURE__*/function (_Component16) {
|
|
935
|
+
_inheritsLoose(Demo, _Component16);
|
|
871
936
|
function Demo() {
|
|
872
|
-
var
|
|
873
|
-
var
|
|
874
|
-
for (var
|
|
875
|
-
args[
|
|
937
|
+
var _context50;
|
|
938
|
+
var _this16;
|
|
939
|
+
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
|
940
|
+
args[_key16] = arguments[_key16];
|
|
876
941
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
return
|
|
942
|
+
_this16 = _Component16.call.apply(_Component16, _concatInstanceProperty(_context50 = [this]).call(_context50, args)) || this;
|
|
943
|
+
_this16.BubbleList = BubbleList;
|
|
944
|
+
return _this16;
|
|
880
945
|
}
|
|
881
946
|
Demo.defaults = function defaults() {
|
|
882
947
|
return {
|
|
@@ -890,39 +955,39 @@ describe('BubbleList', function () {
|
|
|
890
955
|
return Demo;
|
|
891
956
|
}(Component);
|
|
892
957
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList items={this.get('items')}>\n <b:item args=\"scope\">\n <div style=\"height: 40px;\">{scope.item.content}</div>\n </b:item>\n </BubbleList>\n ";
|
|
893
|
-
|
|
958
|
+
_context51.prev = 5;
|
|
894
959
|
mount(Demo);
|
|
895
|
-
|
|
960
|
+
_context51.next = 9;
|
|
896
961
|
return wait(50);
|
|
897
962
|
case 9:
|
|
898
963
|
expect(spy.callCount).to.eql(1);
|
|
899
964
|
expect(spy.args[0][0]).to.contain('stable `key`');
|
|
900
965
|
case 11:
|
|
901
|
-
|
|
966
|
+
_context51.prev = 11;
|
|
902
967
|
console.warn = warn;
|
|
903
|
-
return
|
|
968
|
+
return _context51.finish(11);
|
|
904
969
|
case 14:
|
|
905
970
|
case "end":
|
|
906
|
-
return
|
|
971
|
+
return _context51.stop();
|
|
907
972
|
}
|
|
908
|
-
},
|
|
973
|
+
}, _callee16, null, [[5,, 11, 14]]);
|
|
909
974
|
})));
|
|
910
|
-
it('should render empty slot only when there are no items', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
911
|
-
var Demo,
|
|
912
|
-
return _regeneratorRuntime.wrap(function
|
|
913
|
-
while (1) switch (
|
|
975
|
+
it('should render empty slot only when there are no items', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() {
|
|
976
|
+
var Demo, _mount16, instance, element;
|
|
977
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context53) {
|
|
978
|
+
while (1) switch (_context53.prev = _context53.next) {
|
|
914
979
|
case 0:
|
|
915
|
-
Demo = /*#__PURE__*/function (
|
|
916
|
-
_inheritsLoose(Demo,
|
|
980
|
+
Demo = /*#__PURE__*/function (_Component17) {
|
|
981
|
+
_inheritsLoose(Demo, _Component17);
|
|
917
982
|
function Demo() {
|
|
918
|
-
var
|
|
919
|
-
var
|
|
920
|
-
for (var
|
|
921
|
-
args[
|
|
983
|
+
var _context52;
|
|
984
|
+
var _this17;
|
|
985
|
+
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
|
986
|
+
args[_key17] = arguments[_key17];
|
|
922
987
|
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
return
|
|
988
|
+
_this17 = _Component17.call.apply(_Component17, _concatInstanceProperty(_context52 = [this]).call(_context52, args)) || this;
|
|
989
|
+
_this17.BubbleList = BubbleList;
|
|
990
|
+
return _this17;
|
|
926
991
|
}
|
|
927
992
|
Demo.defaults = function defaults() {
|
|
928
993
|
return {
|
|
@@ -932,8 +997,8 @@ describe('BubbleList', function () {
|
|
|
932
997
|
return Demo;
|
|
933
998
|
}(Component);
|
|
934
999
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n items={this.get('items')}\n >\n <b:empty>\n <div class=\"custom-empty\">empty</div>\n </b:empty>\n </BubbleList>\n ";
|
|
935
|
-
|
|
936
|
-
|
|
1000
|
+
_mount16 = mount(Demo), instance = _mount16[0], element = _mount16[1];
|
|
1001
|
+
_context53.next = 5;
|
|
937
1002
|
return wait(50);
|
|
938
1003
|
case 5:
|
|
939
1004
|
expect(element.querySelector('.custom-empty').textContent).to.eql('empty');
|
|
@@ -941,32 +1006,32 @@ describe('BubbleList', function () {
|
|
|
941
1006
|
key: 1,
|
|
942
1007
|
content: 'hello'
|
|
943
1008
|
}]);
|
|
944
|
-
|
|
1009
|
+
_context53.next = 9;
|
|
945
1010
|
return wait(50);
|
|
946
1011
|
case 9:
|
|
947
1012
|
expect(element.querySelector('.custom-empty')).to.be.null;
|
|
948
1013
|
case 10:
|
|
949
1014
|
case "end":
|
|
950
|
-
return
|
|
1015
|
+
return _context53.stop();
|
|
951
1016
|
}
|
|
952
|
-
},
|
|
1017
|
+
}, _callee17);
|
|
953
1018
|
})));
|
|
954
|
-
it('should keep custom historyLoading slot visible for final no-more-history text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
955
|
-
var Demo,
|
|
956
|
-
return _regeneratorRuntime.wrap(function
|
|
957
|
-
while (1) switch (
|
|
1019
|
+
it('should keep custom historyLoading slot visible for final no-more-history text', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() {
|
|
1020
|
+
var Demo, _mount17, element;
|
|
1021
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context55) {
|
|
1022
|
+
while (1) switch (_context55.prev = _context55.next) {
|
|
958
1023
|
case 0:
|
|
959
|
-
Demo = /*#__PURE__*/function (
|
|
960
|
-
_inheritsLoose(Demo,
|
|
1024
|
+
Demo = /*#__PURE__*/function (_Component18) {
|
|
1025
|
+
_inheritsLoose(Demo, _Component18);
|
|
961
1026
|
function Demo() {
|
|
962
|
-
var
|
|
963
|
-
var
|
|
964
|
-
for (var
|
|
965
|
-
args[
|
|
1027
|
+
var _context54;
|
|
1028
|
+
var _this18;
|
|
1029
|
+
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
|
1030
|
+
args[_key18] = arguments[_key18];
|
|
966
1031
|
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
return
|
|
1032
|
+
_this18 = _Component18.call.apply(_Component18, _concatInstanceProperty(_context54 = [this]).call(_context54, args)) || this;
|
|
1033
|
+
_this18.BubbleList = BubbleList;
|
|
1034
|
+
return _this18;
|
|
970
1035
|
}
|
|
971
1036
|
Demo.defaults = function defaults() {
|
|
972
1037
|
return {
|
|
@@ -979,33 +1044,33 @@ describe('BubbleList', function () {
|
|
|
979
1044
|
return Demo;
|
|
980
1045
|
}(Component);
|
|
981
1046
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n style=\"height: 180px;\"\n items={this.get('items')}\n hasMoreHistory={false}\n loadingHistory={false}\n >\n <b:historyLoading args=\"scope\">\n <div class=\"history-status\">\n {scope.loadingHistory ? 'loading' : scope.hasMoreHistory ? 'more' : 'done'}\n </div>\n </b:historyLoading>\n </BubbleList>\n ";
|
|
982
|
-
|
|
983
|
-
|
|
1047
|
+
_mount17 = mount(Demo), element = _mount17[1];
|
|
1048
|
+
_context55.next = 5;
|
|
984
1049
|
return wait(50);
|
|
985
1050
|
case 5:
|
|
986
1051
|
expect(element.querySelector('.history-status').textContent).to.eql('done');
|
|
987
1052
|
case 6:
|
|
988
1053
|
case "end":
|
|
989
|
-
return
|
|
1054
|
+
return _context55.stop();
|
|
990
1055
|
}
|
|
991
|
-
},
|
|
1056
|
+
}, _callee18);
|
|
992
1057
|
})));
|
|
993
|
-
it('should not render bubble wrappers for empty scoped slots', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
994
|
-
var Demo,
|
|
995
|
-
return _regeneratorRuntime.wrap(function
|
|
996
|
-
while (1) switch (
|
|
1058
|
+
it('should not render bubble wrappers for empty scoped slots', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
|
|
1059
|
+
var Demo, _mount18, element;
|
|
1060
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context57) {
|
|
1061
|
+
while (1) switch (_context57.prev = _context57.next) {
|
|
997
1062
|
case 0:
|
|
998
|
-
Demo = /*#__PURE__*/function (
|
|
999
|
-
_inheritsLoose(Demo,
|
|
1063
|
+
Demo = /*#__PURE__*/function (_Component19) {
|
|
1064
|
+
_inheritsLoose(Demo, _Component19);
|
|
1000
1065
|
function Demo() {
|
|
1001
|
-
var
|
|
1002
|
-
var
|
|
1003
|
-
for (var
|
|
1004
|
-
args[
|
|
1066
|
+
var _context56;
|
|
1067
|
+
var _this19;
|
|
1068
|
+
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
|
1069
|
+
args[_key19] = arguments[_key19];
|
|
1005
1070
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
return
|
|
1071
|
+
_this19 = _Component19.call.apply(_Component19, _concatInstanceProperty(_context56 = [this]).call(_context56, args)) || this;
|
|
1072
|
+
_this19.BubbleList = BubbleList;
|
|
1073
|
+
return _this19;
|
|
1009
1074
|
}
|
|
1010
1075
|
Demo.defaults = function defaults() {
|
|
1011
1076
|
return {
|
|
@@ -1030,34 +1095,34 @@ describe('BubbleList', function () {
|
|
|
1030
1095
|
return Demo;
|
|
1031
1096
|
}(Component);
|
|
1032
1097
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n items={this.get('items')}\n roles={this.get('roles')}\n >\n <b:extra args=\"scope\">\n <span v-if={scope.item.completed} class=\"scoped-extra\">\u5DF2\u5B8C\u6210</span>\n </b:extra>\n </BubbleList>\n ";
|
|
1033
|
-
|
|
1034
|
-
|
|
1098
|
+
_mount18 = mount(Demo), element = _mount18[1];
|
|
1099
|
+
_context57.next = 5;
|
|
1035
1100
|
return wait(50);
|
|
1036
1101
|
case 5:
|
|
1037
1102
|
expect(element.querySelectorAll('.k-bubble-extra').length).to.eql(1);
|
|
1038
1103
|
expect(element.querySelector('.scoped-extra').textContent).to.eql('已完成');
|
|
1039
1104
|
case 7:
|
|
1040
1105
|
case "end":
|
|
1041
|
-
return
|
|
1106
|
+
return _context57.stop();
|
|
1042
1107
|
}
|
|
1043
|
-
},
|
|
1108
|
+
}, _callee19);
|
|
1044
1109
|
})));
|
|
1045
|
-
it('should not render wrappers for empty outer slots', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1046
|
-
var Demo,
|
|
1047
|
-
return _regeneratorRuntime.wrap(function
|
|
1048
|
-
while (1) switch (
|
|
1110
|
+
it('should not render wrappers for empty outer slots', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20() {
|
|
1111
|
+
var Demo, _mount19, element;
|
|
1112
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context59) {
|
|
1113
|
+
while (1) switch (_context59.prev = _context59.next) {
|
|
1049
1114
|
case 0:
|
|
1050
|
-
Demo = /*#__PURE__*/function (
|
|
1051
|
-
_inheritsLoose(Demo,
|
|
1115
|
+
Demo = /*#__PURE__*/function (_Component20) {
|
|
1116
|
+
_inheritsLoose(Demo, _Component20);
|
|
1052
1117
|
function Demo() {
|
|
1053
|
-
var
|
|
1054
|
-
var
|
|
1055
|
-
for (var
|
|
1056
|
-
args[
|
|
1118
|
+
var _context58;
|
|
1119
|
+
var _this20;
|
|
1120
|
+
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
|
1121
|
+
args[_key20] = arguments[_key20];
|
|
1057
1122
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
return
|
|
1123
|
+
_this20 = _Component20.call.apply(_Component20, _concatInstanceProperty(_context58 = [this]).call(_context58, args)) || this;
|
|
1124
|
+
_this20.BubbleList = BubbleList;
|
|
1125
|
+
return _this20;
|
|
1061
1126
|
}
|
|
1062
1127
|
Demo.defaults = function defaults() {
|
|
1063
1128
|
return {
|
|
@@ -1070,8 +1135,8 @@ describe('BubbleList', function () {
|
|
|
1070
1135
|
return Demo;
|
|
1071
1136
|
}(Component);
|
|
1072
1137
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n items={this.get('items')}\n loadingHistory={true}\n >\n <b:header>\n <span v-if={false} class=\"empty-header\">header</span>\n </b:header>\n <b:historyLoading>\n <span v-if={false} class=\"empty-history\">history</span>\n </b:historyLoading>\n <b:listFooter>\n <span v-if={false} class=\"empty-footer\">footer</span>\n </b:listFooter>\n </BubbleList>\n ";
|
|
1073
|
-
|
|
1074
|
-
|
|
1138
|
+
_mount19 = mount(Demo), element = _mount19[1];
|
|
1139
|
+
_context59.next = 5;
|
|
1075
1140
|
return wait(50);
|
|
1076
1141
|
case 5:
|
|
1077
1142
|
expect(element.querySelector('.k-bubble-list-header')).to.eql(null);
|
|
@@ -1080,70 +1145,70 @@ describe('BubbleList', function () {
|
|
|
1080
1145
|
expect(element.querySelector('.k-bubble')).not.to.eql(null);
|
|
1081
1146
|
case 9:
|
|
1082
1147
|
case "end":
|
|
1083
|
-
return
|
|
1148
|
+
return _context59.stop();
|
|
1084
1149
|
}
|
|
1085
|
-
},
|
|
1150
|
+
}, _callee20);
|
|
1086
1151
|
})));
|
|
1087
|
-
it('should not render empty wrapper when empty slot is empty', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1088
|
-
var Demo,
|
|
1089
|
-
return _regeneratorRuntime.wrap(function
|
|
1090
|
-
while (1) switch (
|
|
1152
|
+
it('should not render empty wrapper when empty slot is empty', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
|
|
1153
|
+
var Demo, _mount20, element;
|
|
1154
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context61) {
|
|
1155
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
1091
1156
|
case 0:
|
|
1092
|
-
Demo = /*#__PURE__*/function (
|
|
1093
|
-
_inheritsLoose(Demo,
|
|
1157
|
+
Demo = /*#__PURE__*/function (_Component21) {
|
|
1158
|
+
_inheritsLoose(Demo, _Component21);
|
|
1094
1159
|
function Demo() {
|
|
1095
|
-
var
|
|
1096
|
-
var
|
|
1097
|
-
for (var
|
|
1098
|
-
args[
|
|
1160
|
+
var _context60;
|
|
1161
|
+
var _this21;
|
|
1162
|
+
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
|
1163
|
+
args[_key21] = arguments[_key21];
|
|
1099
1164
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
return
|
|
1165
|
+
_this21 = _Component21.call.apply(_Component21, _concatInstanceProperty(_context60 = [this]).call(_context60, args)) || this;
|
|
1166
|
+
_this21.BubbleList = BubbleList;
|
|
1167
|
+
return _this21;
|
|
1103
1168
|
}
|
|
1104
1169
|
return Demo;
|
|
1105
1170
|
}(Component);
|
|
1106
1171
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList items={[]}>\n <b:empty>\n <span v-if={false} class=\"empty-content\">empty</span>\n </b:empty>\n </BubbleList>\n ";
|
|
1107
|
-
|
|
1108
|
-
|
|
1172
|
+
_mount20 = mount(Demo), element = _mount20[1];
|
|
1173
|
+
_context61.next = 5;
|
|
1109
1174
|
return wait(50);
|
|
1110
1175
|
case 5:
|
|
1111
1176
|
expect(element.querySelector('.k-bubble-list-empty')).to.eql(null);
|
|
1112
1177
|
expect(element.querySelector('.k-bubble-list-items')).not.to.eql(null);
|
|
1113
1178
|
case 7:
|
|
1114
1179
|
case "end":
|
|
1115
|
-
return
|
|
1180
|
+
return _context61.stop();
|
|
1116
1181
|
}
|
|
1117
|
-
},
|
|
1182
|
+
}, _callee21);
|
|
1118
1183
|
})));
|
|
1119
|
-
it('should emit scroll state events and honor showScrollToBottom=false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1120
|
-
var
|
|
1121
|
-
var Demo,
|
|
1122
|
-
return _regeneratorRuntime.wrap(function
|
|
1123
|
-
while (1) switch (
|
|
1184
|
+
it('should emit scroll state events and honor showScrollToBottom=false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
|
|
1185
|
+
var _context64, _context65;
|
|
1186
|
+
var Demo, _mount21, instance, element, scrollBox;
|
|
1187
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context66) {
|
|
1188
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
1124
1189
|
case 0:
|
|
1125
|
-
Demo = /*#__PURE__*/function (
|
|
1126
|
-
_inheritsLoose(Demo,
|
|
1190
|
+
Demo = /*#__PURE__*/function (_Component22) {
|
|
1191
|
+
_inheritsLoose(Demo, _Component22);
|
|
1127
1192
|
function Demo() {
|
|
1128
|
-
var
|
|
1129
|
-
var
|
|
1130
|
-
for (var
|
|
1131
|
-
args[
|
|
1193
|
+
var _context62;
|
|
1194
|
+
var _this22;
|
|
1195
|
+
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
|
1196
|
+
args[_key22] = arguments[_key22];
|
|
1132
1197
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
return
|
|
1198
|
+
_this22 = _Component22.call.apply(_Component22, _concatInstanceProperty(_context62 = [this]).call(_context62, args)) || this;
|
|
1199
|
+
_this22.listRef = null;
|
|
1200
|
+
_this22.BubbleList = BubbleList;
|
|
1201
|
+
return _this22;
|
|
1137
1202
|
}
|
|
1138
1203
|
Demo.defaults = function defaults() {
|
|
1139
|
-
var
|
|
1204
|
+
var _context63;
|
|
1140
1205
|
return {
|
|
1141
1206
|
scrollCount: 0,
|
|
1142
1207
|
bottomStates: [],
|
|
1143
1208
|
autoStates: [],
|
|
1144
|
-
items: _mapInstanceProperty(
|
|
1209
|
+
items: _mapInstanceProperty(_context63 = _Array$from({
|
|
1145
1210
|
length: 12
|
|
1146
|
-
})).call(
|
|
1211
|
+
})).call(_context63, function (_, index) {
|
|
1147
1212
|
return {
|
|
1148
1213
|
key: index,
|
|
1149
1214
|
content: "row-" + index
|
|
@@ -1154,8 +1219,8 @@ describe('BubbleList', function () {
|
|
|
1154
1219
|
return Demo;
|
|
1155
1220
|
}(Component);
|
|
1156
1221
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n ref={(i) => this.listRef = i}\n style=\"height: 180px;\"\n items={this.get('items')}\n showScrollToBottom={false}\n ev-scroll={() => this.set('scrollCount', this.get('scrollCount') + 1)}\n ev-scrollBottomChange={(value) => this.set('bottomStates', [...this.get('bottomStates'), value])}\n ev-autoScrollChange={(value) => this.set('autoStates', [...this.get('autoStates'), value])}\n >\n <b:item args=\"scope\">\n <div style=\"height: 44px;\">{scope.item.content}</div>\n </b:item>\n </BubbleList>\n ";
|
|
1157
|
-
|
|
1158
|
-
|
|
1222
|
+
_mount21 = mount(Demo), instance = _mount21[0], element = _mount21[1];
|
|
1223
|
+
_context66.next = 5;
|
|
1159
1224
|
return wait(80);
|
|
1160
1225
|
case 5:
|
|
1161
1226
|
instance.set({
|
|
@@ -1167,7 +1232,7 @@ describe('BubbleList', function () {
|
|
|
1167
1232
|
scrollBox.scrollTop = 40;
|
|
1168
1233
|
dispatchEvent(scrollBox, 'scroll');
|
|
1169
1234
|
dispatchEvent(scrollBox, 'scroll');
|
|
1170
|
-
|
|
1235
|
+
_context66.next = 12;
|
|
1171
1236
|
return wait(40);
|
|
1172
1237
|
case 12:
|
|
1173
1238
|
_atInstanceProperty(expect(instance.get('scrollCount')).to.be).least(2);
|
|
@@ -1175,37 +1240,37 @@ describe('BubbleList', function () {
|
|
|
1175
1240
|
expect(instance.get('autoStates')).to.eql([false]);
|
|
1176
1241
|
expect(element.querySelector('.k-bubble-list-scroll-to-bottom')).to.be.null;
|
|
1177
1242
|
instance.listRef.scrollToBottom('auto');
|
|
1178
|
-
|
|
1243
|
+
_context66.next = 19;
|
|
1179
1244
|
return wait(50);
|
|
1180
1245
|
case 19:
|
|
1181
|
-
expect(_sliceInstanceProperty(
|
|
1182
|
-
expect(_sliceInstanceProperty(
|
|
1246
|
+
expect(_sliceInstanceProperty(_context64 = instance.get('bottomStates')).call(_context64, -1)[0]).to.eql(true);
|
|
1247
|
+
expect(_sliceInstanceProperty(_context65 = instance.get('autoStates')).call(_context65, -1)[0]).to.eql(true);
|
|
1183
1248
|
expect(instance.listRef.isAtBottom()).to.be.true;
|
|
1184
1249
|
expect(element.querySelector('.k-bubble-list-scroll-to-bottom')).to.be.null;
|
|
1185
1250
|
case 23:
|
|
1186
1251
|
case "end":
|
|
1187
|
-
return
|
|
1252
|
+
return _context66.stop();
|
|
1188
1253
|
}
|
|
1189
|
-
},
|
|
1254
|
+
}, _callee22);
|
|
1190
1255
|
})));
|
|
1191
|
-
it('should forward typing events to role handlers and component events', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1192
|
-
var roleTypingPayload, roleTypingCompletePayload, Demo,
|
|
1193
|
-
return _regeneratorRuntime.wrap(function
|
|
1194
|
-
while (1) switch (
|
|
1256
|
+
it('should forward typing events to role handlers and component events', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
|
|
1257
|
+
var roleTypingPayload, roleTypingCompletePayload, Demo, _mount22, instance;
|
|
1258
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context68) {
|
|
1259
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
1195
1260
|
case 0:
|
|
1196
1261
|
roleTypingPayload = null;
|
|
1197
1262
|
roleTypingCompletePayload = null;
|
|
1198
|
-
Demo = /*#__PURE__*/function (
|
|
1199
|
-
_inheritsLoose(Demo,
|
|
1263
|
+
Demo = /*#__PURE__*/function (_Component23) {
|
|
1264
|
+
_inheritsLoose(Demo, _Component23);
|
|
1200
1265
|
function Demo() {
|
|
1201
|
-
var
|
|
1202
|
-
var
|
|
1203
|
-
for (var
|
|
1204
|
-
args[
|
|
1266
|
+
var _context67;
|
|
1267
|
+
var _this23;
|
|
1268
|
+
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
|
1269
|
+
args[_key23] = arguments[_key23];
|
|
1205
1270
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
return
|
|
1271
|
+
_this23 = _Component23.call.apply(_Component23, _concatInstanceProperty(_context67 = [this]).call(_context67, args)) || this;
|
|
1272
|
+
_this23.BubbleList = BubbleList;
|
|
1273
|
+
return _this23;
|
|
1209
1274
|
}
|
|
1210
1275
|
Demo.defaults = function defaults() {
|
|
1211
1276
|
return {
|
|
@@ -1246,8 +1311,8 @@ describe('BubbleList', function () {
|
|
|
1246
1311
|
return Demo;
|
|
1247
1312
|
}(Component);
|
|
1248
1313
|
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n items={this.get('items')}\n roles={this.get('roles')}\n ev-typing={() => this.set('typingCount', this.get('typingCount') + 1)}\n ev-typingComplete={(item, content) => this.set({\n completeCount: this.get('completeCount') + 1,\n completedContent: item.key + ':' + content,\n })}\n />\n ";
|
|
1249
|
-
|
|
1250
|
-
|
|
1314
|
+
_mount22 = mount(Demo), instance = _mount22[0];
|
|
1315
|
+
_context68.next = 7;
|
|
1251
1316
|
return wait(120);
|
|
1252
1317
|
case 7:
|
|
1253
1318
|
expect(instance.get('typingCount')).to.be.greaterThan(0);
|
|
@@ -1261,8 +1326,84 @@ describe('BubbleList', function () {
|
|
|
1261
1326
|
expect(roleTypingCompletePayload.index).to.eql(0);
|
|
1262
1327
|
case 16:
|
|
1263
1328
|
case "end":
|
|
1264
|
-
return
|
|
1329
|
+
return _context68.stop();
|
|
1265
1330
|
}
|
|
1266
|
-
},
|
|
1331
|
+
}, _callee23);
|
|
1332
|
+
})));
|
|
1333
|
+
it('should pass typing resume options to rendered bubbles', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24() {
|
|
1334
|
+
var Demo, _mount23, element, text, nextText, i;
|
|
1335
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context70) {
|
|
1336
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
1337
|
+
case 0:
|
|
1338
|
+
Demo = /*#__PURE__*/function (_Component24) {
|
|
1339
|
+
_inheritsLoose(Demo, _Component24);
|
|
1340
|
+
function Demo() {
|
|
1341
|
+
var _context69;
|
|
1342
|
+
var _this24;
|
|
1343
|
+
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
|
1344
|
+
args[_key24] = arguments[_key24];
|
|
1345
|
+
}
|
|
1346
|
+
_this24 = _Component24.call.apply(_Component24, _concatInstanceProperty(_context69 = [this]).call(_context69, args)) || this;
|
|
1347
|
+
_this24.BubbleList = BubbleList;
|
|
1348
|
+
return _this24;
|
|
1349
|
+
}
|
|
1350
|
+
Demo.defaults = function defaults() {
|
|
1351
|
+
return {
|
|
1352
|
+
roles: {
|
|
1353
|
+
ai: {
|
|
1354
|
+
placement: 'start',
|
|
1355
|
+
typing: {
|
|
1356
|
+
interval: 16,
|
|
1357
|
+
step: 1
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1361
|
+
items: [{
|
|
1362
|
+
key: 1,
|
|
1363
|
+
role: 'ai',
|
|
1364
|
+
content: 'hello world',
|
|
1365
|
+
streaming: true,
|
|
1366
|
+
typing: {
|
|
1367
|
+
interval: 16,
|
|
1368
|
+
step: 2,
|
|
1369
|
+
resumeFrom: 'hello'
|
|
1370
|
+
}
|
|
1371
|
+
}]
|
|
1372
|
+
};
|
|
1373
|
+
};
|
|
1374
|
+
return Demo;
|
|
1375
|
+
}(Component);
|
|
1376
|
+
Demo.template = "\n const { BubbleList } = this;\n <BubbleList\n items={this.get('items')}\n roles={this.get('roles')}\n />\n ";
|
|
1377
|
+
_mount23 = mount(Demo), element = _mount23[1];
|
|
1378
|
+
text = element.querySelector('.k-bubble-text').textContent || '';
|
|
1379
|
+
expect(text).to.eql('hello');
|
|
1380
|
+
nextText = text;
|
|
1381
|
+
i = 0;
|
|
1382
|
+
case 7:
|
|
1383
|
+
if (!(i < 6)) {
|
|
1384
|
+
_context70.next = 16;
|
|
1385
|
+
break;
|
|
1386
|
+
}
|
|
1387
|
+
_context70.next = 10;
|
|
1388
|
+
return wait(20);
|
|
1389
|
+
case 10:
|
|
1390
|
+
nextText = element.querySelector('.k-bubble-text').textContent || '';
|
|
1391
|
+
if (!(nextText.length > text.length)) {
|
|
1392
|
+
_context70.next = 13;
|
|
1393
|
+
break;
|
|
1394
|
+
}
|
|
1395
|
+
return _context70.abrupt("break", 16);
|
|
1396
|
+
case 13:
|
|
1397
|
+
i++;
|
|
1398
|
+
_context70.next = 7;
|
|
1399
|
+
break;
|
|
1400
|
+
case 16:
|
|
1401
|
+
expect(_startsWithInstanceProperty(nextText).call(nextText, 'hello')).to.be.true;
|
|
1402
|
+
expect(nextText.length).to.be.greaterThan(text.length);
|
|
1403
|
+
case 18:
|
|
1404
|
+
case "end":
|
|
1405
|
+
return _context70.stop();
|
|
1406
|
+
}
|
|
1407
|
+
}, _callee24);
|
|
1267
1408
|
})));
|
|
1268
1409
|
});
|