@king-design/vue 3.8.0-beta.1 → 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/components/bubble/bubble.d.ts +2 -0
- package/components/bubble/index.spec.js +183 -10
- package/components/bubble/useBubbleDisplay.js +60 -22
- package/components/bubbleList/index.spec.js +77 -0
- package/components/sender/index.spec.js +345 -279
- package/components/sender/sender.d.ts +1 -1
- package/components/sender/sender.js +1 -1
- package/components/sender/useAutoResize.js +7 -6
- package/components/xmarkdown/index.spec.js +416 -318
- package/components/xmarkdown/useXMarkdownDisplay.js +60 -23
- package/components/xmarkdown/xmarkdown.d.ts +2 -0
- package/dist/index.js +419 -343
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -1340,11 +1340,10 @@ describe('Sender', function () {
|
|
|
1340
1340
|
}
|
|
1341
1341
|
}, _callee27);
|
|
1342
1342
|
})));
|
|
1343
|
-
it('should
|
|
1344
|
-
var
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
while (1) switch (_context62.prev = _context62.next) {
|
|
1343
|
+
it('should shrink textarea min height only when uploadButton is list', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee28() {
|
|
1344
|
+
var Demo, _mount28, element, toolbarTextarea, listTextarea;
|
|
1345
|
+
return _regeneratorRuntime.wrap(function _callee28$(_context61) {
|
|
1346
|
+
while (1) switch (_context61.prev = _context61.next) {
|
|
1348
1347
|
case 0:
|
|
1349
1348
|
Demo = /*#__PURE__*/function (_Component28) {
|
|
1350
1349
|
_inheritsLoose(Demo, _Component28);
|
|
@@ -1360,114 +1359,105 @@ describe('Sender', function () {
|
|
|
1360
1359
|
}
|
|
1361
1360
|
return Demo;
|
|
1362
1361
|
}(Component);
|
|
1363
|
-
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender
|
|
1362
|
+
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender className=\"sender-toolbar-media\" fileView=\"media\" />\n <Sender className=\"sender-list-card\" uploadButton=\"list\" />\n </div>\n ";
|
|
1364
1363
|
_mount28 = mount(Demo), element = _mount28[1];
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1364
|
+
_context61.next = 5;
|
|
1365
|
+
return wait();
|
|
1366
|
+
case 5:
|
|
1367
|
+
toolbarTextarea = element.querySelector('.sender-toolbar-media .k-sender-input');
|
|
1368
|
+
listTextarea = element.querySelector('.sender-list-card .k-sender-input');
|
|
1369
|
+
expect(toolbarTextarea.style.height).to.eql('64px');
|
|
1370
|
+
expect(listTextarea.style.height).to.eql('20px');
|
|
1371
|
+
case 9:
|
|
1371
1372
|
case "end":
|
|
1372
|
-
return
|
|
1373
|
+
return _context61.stop();
|
|
1373
1374
|
}
|
|
1374
1375
|
}, _callee28);
|
|
1375
1376
|
})));
|
|
1376
|
-
it('should
|
|
1377
|
-
var
|
|
1378
|
-
return _regeneratorRuntime.wrap(function _callee29$(
|
|
1379
|
-
while (1) switch (
|
|
1377
|
+
it('should use 300px as the default shell maxHeight', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {
|
|
1378
|
+
var Demo, _mount29, element, shell;
|
|
1379
|
+
return _regeneratorRuntime.wrap(function _callee29$(_context63) {
|
|
1380
|
+
while (1) switch (_context63.prev = _context63.next) {
|
|
1380
1381
|
case 0:
|
|
1381
|
-
lastAttachments = [];
|
|
1382
1382
|
Demo = /*#__PURE__*/function (_Component29) {
|
|
1383
1383
|
_inheritsLoose(Demo, _Component29);
|
|
1384
1384
|
function Demo() {
|
|
1385
|
-
var
|
|
1385
|
+
var _context62;
|
|
1386
1386
|
var _this29;
|
|
1387
1387
|
for (var _len29 = arguments.length, args = new Array(_len29), _key29 = 0; _key29 < _len29; _key29++) {
|
|
1388
1388
|
args[_key29] = arguments[_key29];
|
|
1389
1389
|
}
|
|
1390
|
-
_this29 = _Component29.call.apply(_Component29, _concatInstanceProperty(
|
|
1390
|
+
_this29 = _Component29.call.apply(_Component29, _concatInstanceProperty(_context62 = [this]).call(_context62, args)) || this;
|
|
1391
1391
|
_this29.Sender = Sender;
|
|
1392
|
-
_this29.file = new File(['hello'], 'hello.txt', {
|
|
1393
|
-
type: 'text/plain'
|
|
1394
|
-
});
|
|
1395
|
-
_this29.onChange = function (items) {
|
|
1396
|
-
lastAttachments = items;
|
|
1397
|
-
};
|
|
1398
1392
|
return _this29;
|
|
1399
1393
|
}
|
|
1400
|
-
Demo.defaults = function defaults() {
|
|
1401
|
-
return {
|
|
1402
|
-
attachments: []
|
|
1403
|
-
};
|
|
1404
|
-
};
|
|
1405
1394
|
return Demo;
|
|
1406
1395
|
}(Component);
|
|
1407
|
-
Demo.template = "
|
|
1396
|
+
Demo.template = "const { Sender } = this; <div><Sender /></div>";
|
|
1408
1397
|
_mount29 = mount(Demo), element = _mount29[1];
|
|
1409
|
-
|
|
1410
|
-
button.click();
|
|
1411
|
-
_context64.next = 8;
|
|
1398
|
+
_context63.next = 5;
|
|
1412
1399
|
return wait();
|
|
1413
|
-
case
|
|
1414
|
-
|
|
1415
|
-
expect(
|
|
1416
|
-
|
|
1417
|
-
case 11:
|
|
1400
|
+
case 5:
|
|
1401
|
+
shell = element.querySelector('.k-sender-shell');
|
|
1402
|
+
expect(shell.style.maxHeight).to.eql('300px');
|
|
1403
|
+
case 7:
|
|
1418
1404
|
case "end":
|
|
1419
|
-
return
|
|
1405
|
+
return _context63.stop();
|
|
1420
1406
|
}
|
|
1421
1407
|
}, _callee29);
|
|
1422
1408
|
})));
|
|
1423
|
-
it('should
|
|
1424
|
-
var
|
|
1425
|
-
var Demo, _mount30, element;
|
|
1426
|
-
return _regeneratorRuntime.wrap(function _callee30$(
|
|
1427
|
-
while (1) switch (
|
|
1409
|
+
it('should pass uploadButton slot params and render it in toolbar', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30() {
|
|
1410
|
+
var _context65;
|
|
1411
|
+
var Demo, _mount30, element, button;
|
|
1412
|
+
return _regeneratorRuntime.wrap(function _callee30$(_context66) {
|
|
1413
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
1428
1414
|
case 0:
|
|
1429
1415
|
Demo = /*#__PURE__*/function (_Component30) {
|
|
1430
1416
|
_inheritsLoose(Demo, _Component30);
|
|
1431
1417
|
function Demo() {
|
|
1432
|
-
var
|
|
1418
|
+
var _context64;
|
|
1433
1419
|
var _this30;
|
|
1434
1420
|
for (var _len30 = arguments.length, args = new Array(_len30), _key30 = 0; _key30 < _len30; _key30++) {
|
|
1435
1421
|
args[_key30] = arguments[_key30];
|
|
1436
1422
|
}
|
|
1437
|
-
_this30 = _Component30.call.apply(_Component30, _concatInstanceProperty(
|
|
1423
|
+
_this30 = _Component30.call.apply(_Component30, _concatInstanceProperty(_context64 = [this]).call(_context64, args)) || this;
|
|
1438
1424
|
_this30.Sender = Sender;
|
|
1439
1425
|
return _this30;
|
|
1440
1426
|
}
|
|
1441
1427
|
return Demo;
|
|
1442
1428
|
}(Component);
|
|
1443
|
-
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender
|
|
1429
|
+
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender uploadProps={{limit: 1}} attachments={[\n {key: 'a', uid: 'a', name: 'note.txt'},\n ]}>\n <b:uploadButton args=\"scope\">\n <button\n class=\"custom-upload\"\n disabled={scope.disabled || scope.reachLimit}\n ev-click={scope.pickFiles}\n >{scope.position}</button>\n </b:uploadButton>\n </Sender>\n </div>\n ";
|
|
1444
1430
|
_mount30 = mount(Demo), element = _mount30[1];
|
|
1445
|
-
|
|
1446
|
-
expect(
|
|
1447
|
-
expect(_trimInstanceProperty(
|
|
1448
|
-
|
|
1431
|
+
button = element.querySelector('.custom-upload');
|
|
1432
|
+
expect(button).not.to.eql(null);
|
|
1433
|
+
expect(_trimInstanceProperty(_context65 = button.textContent).call(_context65)).to.eql('toolbar');
|
|
1434
|
+
expect(button.disabled).to.eql(true);
|
|
1435
|
+
expect(element.querySelector('.k-sender-attach-btn')).to.eql(null);
|
|
1436
|
+
case 8:
|
|
1449
1437
|
case "end":
|
|
1450
|
-
return
|
|
1438
|
+
return _context66.stop();
|
|
1451
1439
|
}
|
|
1452
1440
|
}, _callee30);
|
|
1453
1441
|
})));
|
|
1454
|
-
it('should
|
|
1455
|
-
var lastAttachments, Demo, _mount31,
|
|
1456
|
-
return _regeneratorRuntime.wrap(function _callee31$(
|
|
1457
|
-
while (1) switch (
|
|
1442
|
+
it('should add local files through uploadButton slot params', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
|
|
1443
|
+
var lastAttachments, Demo, _mount31, element, button;
|
|
1444
|
+
return _regeneratorRuntime.wrap(function _callee31$(_context68) {
|
|
1445
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
1458
1446
|
case 0:
|
|
1459
1447
|
lastAttachments = [];
|
|
1460
1448
|
Demo = /*#__PURE__*/function (_Component31) {
|
|
1461
1449
|
_inheritsLoose(Demo, _Component31);
|
|
1462
1450
|
function Demo() {
|
|
1463
|
-
var
|
|
1451
|
+
var _context67;
|
|
1464
1452
|
var _this31;
|
|
1465
1453
|
for (var _len31 = arguments.length, args = new Array(_len31), _key31 = 0; _key31 < _len31; _key31++) {
|
|
1466
1454
|
args[_key31] = arguments[_key31];
|
|
1467
1455
|
}
|
|
1468
|
-
_this31 = _Component31.call.apply(_Component31, _concatInstanceProperty(
|
|
1456
|
+
_this31 = _Component31.call.apply(_Component31, _concatInstanceProperty(_context67 = [this]).call(_context67, args)) || this;
|
|
1469
1457
|
_this31.Sender = Sender;
|
|
1470
|
-
_this31.
|
|
1458
|
+
_this31.file = new File(['hello'], 'hello.txt', {
|
|
1459
|
+
type: 'text/plain'
|
|
1460
|
+
});
|
|
1471
1461
|
_this31.onChange = function (items) {
|
|
1472
1462
|
lastAttachments = items;
|
|
1473
1463
|
};
|
|
@@ -1480,25 +1470,24 @@ describe('Sender', function () {
|
|
|
1480
1470
|
};
|
|
1481
1471
|
return Demo;
|
|
1482
1472
|
}(Component);
|
|
1483
|
-
Demo.template = "\n const { Sender } = this;\n <Sender\n
|
|
1484
|
-
_mount31 = mount(Demo),
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
instance.senderRef.addFiles([file]);
|
|
1489
|
-
_context69.next = 8;
|
|
1473
|
+
Demo.template = "\n const { Sender } = this;\n <Sender\n attachments={this.get('attachments')}\n uploadProps={{accept: '.txt', autoUpload: false}}\n ev-$change:attachments={this.onChange}\n >\n <b:uploadButton args=\"scope\">\n <button\n class=\"custom-add-files\"\n ev-click={() => scope.addFiles([this.file])}\n >add</button>\n </b:uploadButton>\n </Sender>\n ";
|
|
1474
|
+
_mount31 = mount(Demo), element = _mount31[1];
|
|
1475
|
+
button = element.querySelector('.custom-add-files');
|
|
1476
|
+
button.click();
|
|
1477
|
+
_context68.next = 8;
|
|
1490
1478
|
return wait();
|
|
1491
1479
|
case 8:
|
|
1492
1480
|
expect(lastAttachments.length).to.eql(1);
|
|
1493
|
-
expect(lastAttachments[0].name).to.eql('
|
|
1481
|
+
expect(lastAttachments[0].name).to.eql('hello.txt');
|
|
1494
1482
|
expect(lastAttachments[0].status).to.eql('default');
|
|
1495
1483
|
case 11:
|
|
1496
1484
|
case "end":
|
|
1497
|
-
return
|
|
1485
|
+
return _context68.stop();
|
|
1498
1486
|
}
|
|
1499
1487
|
}, _callee31);
|
|
1500
1488
|
})));
|
|
1501
|
-
it('should render
|
|
1489
|
+
it('should render uploadButton slot in attachment list when uploadButton is list', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32() {
|
|
1490
|
+
var _context70;
|
|
1502
1491
|
var Demo, _mount32, element;
|
|
1503
1492
|
return _regeneratorRuntime.wrap(function _callee32$(_context71) {
|
|
1504
1493
|
while (1) switch (_context71.prev = _context71.next) {
|
|
@@ -1506,32 +1495,34 @@ describe('Sender', function () {
|
|
|
1506
1495
|
Demo = /*#__PURE__*/function (_Component32) {
|
|
1507
1496
|
_inheritsLoose(Demo, _Component32);
|
|
1508
1497
|
function Demo() {
|
|
1509
|
-
var
|
|
1498
|
+
var _context69;
|
|
1510
1499
|
var _this32;
|
|
1511
1500
|
for (var _len32 = arguments.length, args = new Array(_len32), _key32 = 0; _key32 < _len32; _key32++) {
|
|
1512
1501
|
args[_key32] = arguments[_key32];
|
|
1513
1502
|
}
|
|
1514
|
-
_this32 = _Component32.call.apply(_Component32, _concatInstanceProperty(
|
|
1503
|
+
_this32 = _Component32.call.apply(_Component32, _concatInstanceProperty(_context69 = [this]).call(_context69, args)) || this;
|
|
1515
1504
|
_this32.Sender = Sender;
|
|
1516
1505
|
return _this32;
|
|
1517
1506
|
}
|
|
1518
1507
|
return Demo;
|
|
1519
1508
|
}(Component);
|
|
1520
|
-
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender
|
|
1521
|
-
_mount32 = mount(Demo), element = _mount32[1];
|
|
1522
|
-
expect(element.
|
|
1523
|
-
expect(element.
|
|
1524
|
-
|
|
1509
|
+
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender uploadButton=\"list\">\n <b:uploadButton args=\"scope\">\n <button class=\"custom-list-upload\" ev-click={scope.pickFiles}>{scope.position}</button>\n </b:uploadButton>\n </Sender>\n </div>\n ";
|
|
1510
|
+
_mount32 = mount(Demo), element = _mount32[1];
|
|
1511
|
+
expect(element.querySelector('.k-sender-toolbar-left')).to.eql(null);
|
|
1512
|
+
expect(element.querySelector('.k-sender-list-upload')).to.eql(null);
|
|
1513
|
+
expect(_trimInstanceProperty(_context70 = element.querySelector('.k-file-card-list-prefix .custom-list-upload').textContent).call(_context70)).to.eql('list');
|
|
1514
|
+
case 6:
|
|
1525
1515
|
case "end":
|
|
1526
1516
|
return _context71.stop();
|
|
1527
1517
|
}
|
|
1528
1518
|
}, _callee32);
|
|
1529
1519
|
})));
|
|
1530
|
-
it('should
|
|
1531
|
-
var Demo, _mount33,
|
|
1520
|
+
it('should expose addFiles method', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33() {
|
|
1521
|
+
var lastAttachments, Demo, _mount33, instance, file;
|
|
1532
1522
|
return _regeneratorRuntime.wrap(function _callee33$(_context73) {
|
|
1533
1523
|
while (1) switch (_context73.prev = _context73.next) {
|
|
1534
1524
|
case 0:
|
|
1525
|
+
lastAttachments = [];
|
|
1535
1526
|
Demo = /*#__PURE__*/function (_Component33) {
|
|
1536
1527
|
_inheritsLoose(Demo, _Component33);
|
|
1537
1528
|
function Demo() {
|
|
@@ -1542,21 +1533,39 @@ describe('Sender', function () {
|
|
|
1542
1533
|
}
|
|
1543
1534
|
_this33 = _Component33.call.apply(_Component33, _concatInstanceProperty(_context72 = [this]).call(_context72, args)) || this;
|
|
1544
1535
|
_this33.Sender = Sender;
|
|
1536
|
+
_this33.senderRef = null;
|
|
1537
|
+
_this33.onChange = function (items) {
|
|
1538
|
+
lastAttachments = items;
|
|
1539
|
+
};
|
|
1545
1540
|
return _this33;
|
|
1546
1541
|
}
|
|
1542
|
+
Demo.defaults = function defaults() {
|
|
1543
|
+
return {
|
|
1544
|
+
attachments: []
|
|
1545
|
+
};
|
|
1546
|
+
};
|
|
1547
1547
|
return Demo;
|
|
1548
1548
|
}(Component);
|
|
1549
|
-
Demo.template = "\n const { Sender } = this;\n <
|
|
1550
|
-
_mount33 = mount(Demo),
|
|
1551
|
-
|
|
1552
|
-
|
|
1549
|
+
Demo.template = "\n const { Sender } = this;\n <Sender\n ref={(i) => this.senderRef = i}\n attachments={this.get('attachments')}\n uploadProps={{autoUpload: false}}\n ev-$change:attachments={this.onChange}\n />\n ";
|
|
1550
|
+
_mount33 = mount(Demo), instance = _mount33[0];
|
|
1551
|
+
file = new File(['hello'], 'dialog.txt', {
|
|
1552
|
+
type: 'text/plain'
|
|
1553
|
+
});
|
|
1554
|
+
instance.senderRef.addFiles([file]);
|
|
1555
|
+
_context73.next = 8;
|
|
1556
|
+
return wait();
|
|
1557
|
+
case 8:
|
|
1558
|
+
expect(lastAttachments.length).to.eql(1);
|
|
1559
|
+
expect(lastAttachments[0].name).to.eql('dialog.txt');
|
|
1560
|
+
expect(lastAttachments[0].status).to.eql('default');
|
|
1561
|
+
case 11:
|
|
1553
1562
|
case "end":
|
|
1554
1563
|
return _context73.stop();
|
|
1555
1564
|
}
|
|
1556
1565
|
}, _callee33);
|
|
1557
1566
|
})));
|
|
1558
|
-
it('should
|
|
1559
|
-
var Demo, _mount34, element
|
|
1567
|
+
it('should render card-view attachments uniformly as file cards', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34() {
|
|
1568
|
+
var Demo, _mount34, element;
|
|
1560
1569
|
return _regeneratorRuntime.wrap(function _callee34$(_context75) {
|
|
1561
1570
|
while (1) switch (_context75.prev = _context75.next) {
|
|
1562
1571
|
case 0:
|
|
@@ -1574,18 +1583,17 @@ describe('Sender', function () {
|
|
|
1574
1583
|
}
|
|
1575
1584
|
return Demo;
|
|
1576
1585
|
}(Component);
|
|
1577
|
-
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender
|
|
1578
|
-
_mount34 = mount(Demo), element = _mount34[1];
|
|
1579
|
-
|
|
1580
|
-
expect(
|
|
1581
|
-
|
|
1582
|
-
case 6:
|
|
1586
|
+
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender attachments={[\n {key: 'a', uid: 'a', name: 'pic.png', type: 'image/png', src: 'data:image/png;base64,AAAA'},\n {key: 'b', uid: 'b', name: 'note.txt', type: 'text/plain'},\n ]} />\n </div>\n ";
|
|
1587
|
+
_mount34 = mount(Demo), element = _mount34[1]; // card 视图下,图片附件也应当以「文件卡」形式呈现,而不是图片缩略图
|
|
1588
|
+
expect(element.querySelectorAll('.k-file-card-file').length).to.eql(2);
|
|
1589
|
+
expect(element.querySelectorAll('.k-file-card-media').length).to.eql(0);
|
|
1590
|
+
case 5:
|
|
1583
1591
|
case "end":
|
|
1584
1592
|
return _context75.stop();
|
|
1585
1593
|
}
|
|
1586
1594
|
}, _callee34);
|
|
1587
1595
|
})));
|
|
1588
|
-
it('should
|
|
1596
|
+
it('should keep image media cards (square) in media view', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee35() {
|
|
1589
1597
|
var Demo, _mount35, element;
|
|
1590
1598
|
return _regeneratorRuntime.wrap(function _callee35$(_context77) {
|
|
1591
1599
|
while (1) switch (_context77.prev = _context77.next) {
|
|
@@ -1604,18 +1612,17 @@ describe('Sender', function () {
|
|
|
1604
1612
|
}
|
|
1605
1613
|
return Demo;
|
|
1606
1614
|
}(Component);
|
|
1607
|
-
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender fileView=\"media\" attachments={[\n {key: 'a', uid: 'a', name: 'pic.png', type: '
|
|
1608
|
-
_mount35 = mount(Demo), element = _mount35[1];
|
|
1615
|
+
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender fileView=\"media\" attachments={[\n {key: 'a', uid: 'a', name: 'pic.png', type: 'image/png', src: 'data:image/png;base64,AAAA'},\n ]} />\n </div>\n ";
|
|
1616
|
+
_mount35 = mount(Demo), element = _mount35[1]; // media 视图下保留 FileCard 的图片渲染(自带 1:1 裁剪),不强制转成 file 卡片
|
|
1609
1617
|
expect(element.querySelector('.k-file-card-media.k-file-card-type-image')).not.to.eql(null);
|
|
1610
|
-
|
|
1611
|
-
case 5:
|
|
1618
|
+
case 4:
|
|
1612
1619
|
case "end":
|
|
1613
1620
|
return _context77.stop();
|
|
1614
1621
|
}
|
|
1615
1622
|
}, _callee35);
|
|
1616
1623
|
})));
|
|
1617
|
-
it('should
|
|
1618
|
-
var Demo, _mount36, element;
|
|
1624
|
+
it('should enable name tooltip for Sender media attachments', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36() {
|
|
1625
|
+
var Demo, _mount36, element, mediaView;
|
|
1619
1626
|
return _regeneratorRuntime.wrap(function _callee36$(_context79) {
|
|
1620
1627
|
while (1) switch (_context79.prev = _context79.next) {
|
|
1621
1628
|
case 0:
|
|
@@ -1633,22 +1640,22 @@ describe('Sender', function () {
|
|
|
1633
1640
|
}
|
|
1634
1641
|
return Demo;
|
|
1635
1642
|
}(Component);
|
|
1636
|
-
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender fileView=\"media\" attachments={[\n {key: 'a', uid: 'a', name: '
|
|
1643
|
+
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender fileView=\"media\" attachments={[\n {key: 'a', uid: 'a', name: 'very-long-image-name.png', type: 'image/png', src: 'data:image/png;base64,AAAA'},\n ]} />\n </div>\n ";
|
|
1637
1644
|
_mount36 = mount(Demo), element = _mount36[1];
|
|
1638
|
-
|
|
1639
|
-
expect(
|
|
1640
|
-
|
|
1645
|
+
mediaView = element.querySelector('.k-file-card-media-view');
|
|
1646
|
+
expect(mediaView.querySelector('.k-media-name-tooltip-trigger')).not.to.eql(null);
|
|
1647
|
+
expect(mediaView.getAttribute('title')).to.eql(null);
|
|
1648
|
+
case 6:
|
|
1641
1649
|
case "end":
|
|
1642
1650
|
return _context79.stop();
|
|
1643
1651
|
}
|
|
1644
1652
|
}, _callee36);
|
|
1645
1653
|
})));
|
|
1646
|
-
it('should
|
|
1647
|
-
var
|
|
1654
|
+
it('should infer media type from name in media view when attachment type is generic mime', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37() {
|
|
1655
|
+
var Demo, _mount37, element;
|
|
1648
1656
|
return _regeneratorRuntime.wrap(function _callee37$(_context81) {
|
|
1649
1657
|
while (1) switch (_context81.prev = _context81.next) {
|
|
1650
1658
|
case 0:
|
|
1651
|
-
lastAttachments = [];
|
|
1652
1659
|
Demo = /*#__PURE__*/function (_Component37) {
|
|
1653
1660
|
_inheritsLoose(Demo, _Component37);
|
|
1654
1661
|
function Demo() {
|
|
@@ -1659,10 +1666,69 @@ describe('Sender', function () {
|
|
|
1659
1666
|
}
|
|
1660
1667
|
_this37 = _Component37.call.apply(_Component37, _concatInstanceProperty(_context80 = [this]).call(_context80, args)) || this;
|
|
1661
1668
|
_this37.Sender = Sender;
|
|
1662
|
-
_this37
|
|
1669
|
+
return _this37;
|
|
1670
|
+
}
|
|
1671
|
+
return Demo;
|
|
1672
|
+
}(Component);
|
|
1673
|
+
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender fileView=\"media\" attachments={[\n {key: 'a', uid: 'a', name: 'pic.png', type: 'application/octet-stream', src: 'blob:mock'},\n ]} />\n </div>\n ";
|
|
1674
|
+
_mount37 = mount(Demo), element = _mount37[1];
|
|
1675
|
+
expect(element.querySelector('.k-file-card-media.k-file-card-type-image')).not.to.eql(null);
|
|
1676
|
+
expect(element.querySelector('.k-file-card-file')).to.eql(null);
|
|
1677
|
+
case 5:
|
|
1678
|
+
case "end":
|
|
1679
|
+
return _context81.stop();
|
|
1680
|
+
}
|
|
1681
|
+
}, _callee37);
|
|
1682
|
+
})));
|
|
1683
|
+
it('should keep explicit image type in media view even when src has no extension', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee38() {
|
|
1684
|
+
var Demo, _mount38, element;
|
|
1685
|
+
return _regeneratorRuntime.wrap(function _callee38$(_context83) {
|
|
1686
|
+
while (1) switch (_context83.prev = _context83.next) {
|
|
1687
|
+
case 0:
|
|
1688
|
+
Demo = /*#__PURE__*/function (_Component38) {
|
|
1689
|
+
_inheritsLoose(Demo, _Component38);
|
|
1690
|
+
function Demo() {
|
|
1691
|
+
var _context82;
|
|
1692
|
+
var _this38;
|
|
1693
|
+
for (var _len38 = arguments.length, args = new Array(_len38), _key38 = 0; _key38 < _len38; _key38++) {
|
|
1694
|
+
args[_key38] = arguments[_key38];
|
|
1695
|
+
}
|
|
1696
|
+
_this38 = _Component38.call.apply(_Component38, _concatInstanceProperty(_context82 = [this]).call(_context82, args)) || this;
|
|
1697
|
+
_this38.Sender = Sender;
|
|
1698
|
+
return _this38;
|
|
1699
|
+
}
|
|
1700
|
+
return Demo;
|
|
1701
|
+
}(Component);
|
|
1702
|
+
Demo.template = "\n const { Sender } = this;\n <div>\n <Sender fileView=\"media\" attachments={[\n {key: 'a', uid: 'a', name: 'unsplash.jpg', type: 'image', src: 'https://images.unsplash.com/photo-1492691527719-9d1e07e534b4?auto=format&fit=crop&w=1200&q=80'},\n ]} />\n </div>\n ";
|
|
1703
|
+
_mount38 = mount(Demo), element = _mount38[1];
|
|
1704
|
+
expect(element.querySelector('.k-file-card-media.k-file-card-type-image')).not.to.eql(null);
|
|
1705
|
+
expect(element.querySelector('.k-media-image')).not.to.eql(null);
|
|
1706
|
+
case 5:
|
|
1707
|
+
case "end":
|
|
1708
|
+
return _context83.stop();
|
|
1709
|
+
}
|
|
1710
|
+
}, _callee38);
|
|
1711
|
+
})));
|
|
1712
|
+
it('should support directory selection and preserve relative path metadata', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39() {
|
|
1713
|
+
var lastAttachments, Demo, _mount39, element, input, file;
|
|
1714
|
+
return _regeneratorRuntime.wrap(function _callee39$(_context85) {
|
|
1715
|
+
while (1) switch (_context85.prev = _context85.next) {
|
|
1716
|
+
case 0:
|
|
1717
|
+
lastAttachments = [];
|
|
1718
|
+
Demo = /*#__PURE__*/function (_Component39) {
|
|
1719
|
+
_inheritsLoose(Demo, _Component39);
|
|
1720
|
+
function Demo() {
|
|
1721
|
+
var _context84;
|
|
1722
|
+
var _this39;
|
|
1723
|
+
for (var _len39 = arguments.length, args = new Array(_len39), _key39 = 0; _key39 < _len39; _key39++) {
|
|
1724
|
+
args[_key39] = arguments[_key39];
|
|
1725
|
+
}
|
|
1726
|
+
_this39 = _Component39.call.apply(_Component39, _concatInstanceProperty(_context84 = [this]).call(_context84, args)) || this;
|
|
1727
|
+
_this39.Sender = Sender;
|
|
1728
|
+
_this39.onChange = function (items) {
|
|
1663
1729
|
lastAttachments = items;
|
|
1664
1730
|
};
|
|
1665
|
-
return
|
|
1731
|
+
return _this39;
|
|
1666
1732
|
}
|
|
1667
1733
|
Demo.defaults = function defaults() {
|
|
1668
1734
|
return {
|
|
@@ -1672,7 +1738,7 @@ describe('Sender', function () {
|
|
|
1672
1738
|
return Demo;
|
|
1673
1739
|
}(Component);
|
|
1674
1740
|
Demo.template = "\n const { Sender } = this;\n <Sender\n attachments={this.get('attachments')}\n uploadProps={{directory: true}}\n ev-$change:attachments={this.onChange}\n />\n ";
|
|
1675
|
-
|
|
1741
|
+
_mount39 = mount(Demo), element = _mount39[1];
|
|
1676
1742
|
input = element.querySelector('.k-sender-file-input');
|
|
1677
1743
|
expect(input.getAttribute('directory')).to.eql('');
|
|
1678
1744
|
expect(input.getAttribute('webkitdirectory')).to.eql('');
|
|
@@ -1688,7 +1754,7 @@ describe('Sender', function () {
|
|
|
1688
1754
|
configurable: true
|
|
1689
1755
|
});
|
|
1690
1756
|
dispatchEvent(input, 'change');
|
|
1691
|
-
|
|
1757
|
+
_context85.next = 13;
|
|
1692
1758
|
return wait();
|
|
1693
1759
|
case 13:
|
|
1694
1760
|
expect(lastAttachments.length).to.eql(1);
|
|
@@ -1696,31 +1762,31 @@ describe('Sender', function () {
|
|
|
1696
1762
|
expect(lastAttachments[0].relativePath).to.eql('docs/hello.txt');
|
|
1697
1763
|
case 16:
|
|
1698
1764
|
case "end":
|
|
1699
|
-
return
|
|
1765
|
+
return _context85.stop();
|
|
1700
1766
|
}
|
|
1701
|
-
},
|
|
1767
|
+
}, _callee39);
|
|
1702
1768
|
})));
|
|
1703
|
-
it('should support mapAttachment for runtime uploading items', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1769
|
+
it('should support mapAttachment for runtime uploading items', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40() {
|
|
1704
1770
|
var _element$querySelecto;
|
|
1705
|
-
var lastAttachments, resolveBeforeUpload, Demo,
|
|
1706
|
-
return _regeneratorRuntime.wrap(function
|
|
1707
|
-
while (1) switch (
|
|
1771
|
+
var lastAttachments, resolveBeforeUpload, Demo, _mount40, element, input, file;
|
|
1772
|
+
return _regeneratorRuntime.wrap(function _callee40$(_context87) {
|
|
1773
|
+
while (1) switch (_context87.prev = _context87.next) {
|
|
1708
1774
|
case 0:
|
|
1709
1775
|
lastAttachments = [];
|
|
1710
|
-
Demo = /*#__PURE__*/function (
|
|
1711
|
-
_inheritsLoose(Demo,
|
|
1776
|
+
Demo = /*#__PURE__*/function (_Component40) {
|
|
1777
|
+
_inheritsLoose(Demo, _Component40);
|
|
1712
1778
|
function Demo() {
|
|
1713
|
-
var
|
|
1714
|
-
var
|
|
1715
|
-
for (var
|
|
1716
|
-
args[
|
|
1779
|
+
var _context86;
|
|
1780
|
+
var _this40;
|
|
1781
|
+
for (var _len40 = arguments.length, args = new Array(_len40), _key40 = 0; _key40 < _len40; _key40++) {
|
|
1782
|
+
args[_key40] = arguments[_key40];
|
|
1717
1783
|
}
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1784
|
+
_this40 = _Component40.call.apply(_Component40, _concatInstanceProperty(_context86 = [this]).call(_context86, args)) || this;
|
|
1785
|
+
_this40.Sender = Sender;
|
|
1786
|
+
_this40.onChange = function (items) {
|
|
1721
1787
|
lastAttachments = items;
|
|
1722
1788
|
};
|
|
1723
|
-
return
|
|
1789
|
+
return _this40;
|
|
1724
1790
|
}
|
|
1725
1791
|
Demo.defaults = function defaults() {
|
|
1726
1792
|
return {
|
|
@@ -1747,7 +1813,7 @@ describe('Sender', function () {
|
|
|
1747
1813
|
return Demo;
|
|
1748
1814
|
}(Component);
|
|
1749
1815
|
Demo.template = "\n const { Sender } = this;\n <Sender\n attachments={this.get('attachments')}\n uploadProps={this.getUploadProps()}\n ev-$change:attachments={this.onChange}\n />\n ";
|
|
1750
|
-
|
|
1816
|
+
_mount40 = mount(Demo), element = _mount40[1];
|
|
1751
1817
|
input = element.querySelector('.k-sender-file-input');
|
|
1752
1818
|
file = new File(['hello'], 'hello.txt', {
|
|
1753
1819
|
type: 'text/plain'
|
|
@@ -1757,7 +1823,7 @@ describe('Sender', function () {
|
|
|
1757
1823
|
configurable: true
|
|
1758
1824
|
});
|
|
1759
1825
|
dispatchEvent(input, 'change');
|
|
1760
|
-
|
|
1826
|
+
_context87.next = 10;
|
|
1761
1827
|
return wait();
|
|
1762
1828
|
case 10:
|
|
1763
1829
|
expect(lastAttachments.length).to.eql(1);
|
|
@@ -1769,30 +1835,30 @@ describe('Sender', function () {
|
|
|
1769
1835
|
}
|
|
1770
1836
|
case 15:
|
|
1771
1837
|
case "end":
|
|
1772
|
-
return
|
|
1838
|
+
return _context87.stop();
|
|
1773
1839
|
}
|
|
1774
|
-
},
|
|
1840
|
+
}, _callee40);
|
|
1775
1841
|
})));
|
|
1776
|
-
it('should show fullscreen drag mask and add dropped files when dragFile is enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1777
|
-
var lastAttachments, Demo,
|
|
1778
|
-
return _regeneratorRuntime.wrap(function
|
|
1779
|
-
while (1) switch (
|
|
1842
|
+
it('should show fullscreen drag mask and add dropped files when dragFile is enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {
|
|
1843
|
+
var lastAttachments, Demo, _mount41, element, file, mask, card, icon, text;
|
|
1844
|
+
return _regeneratorRuntime.wrap(function _callee41$(_context89) {
|
|
1845
|
+
while (1) switch (_context89.prev = _context89.next) {
|
|
1780
1846
|
case 0:
|
|
1781
1847
|
lastAttachments = [];
|
|
1782
|
-
Demo = /*#__PURE__*/function (
|
|
1783
|
-
_inheritsLoose(Demo,
|
|
1848
|
+
Demo = /*#__PURE__*/function (_Component41) {
|
|
1849
|
+
_inheritsLoose(Demo, _Component41);
|
|
1784
1850
|
function Demo() {
|
|
1785
|
-
var
|
|
1786
|
-
var
|
|
1787
|
-
for (var
|
|
1788
|
-
args[
|
|
1851
|
+
var _context88;
|
|
1852
|
+
var _this41;
|
|
1853
|
+
for (var _len41 = arguments.length, args = new Array(_len41), _key41 = 0; _key41 < _len41; _key41++) {
|
|
1854
|
+
args[_key41] = arguments[_key41];
|
|
1789
1855
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1856
|
+
_this41 = _Component41.call.apply(_Component41, _concatInstanceProperty(_context88 = [this]).call(_context88, args)) || this;
|
|
1857
|
+
_this41.Sender = Sender;
|
|
1858
|
+
_this41.onChange = function (items) {
|
|
1793
1859
|
lastAttachments = items;
|
|
1794
1860
|
};
|
|
1795
|
-
return
|
|
1861
|
+
return _this41;
|
|
1796
1862
|
}
|
|
1797
1863
|
Demo.defaults = function defaults() {
|
|
1798
1864
|
return {
|
|
@@ -1802,14 +1868,14 @@ describe('Sender', function () {
|
|
|
1802
1868
|
return Demo;
|
|
1803
1869
|
}(Component);
|
|
1804
1870
|
Demo.template = "\n const { Sender } = this;\n <Sender\n dragFile={true}\n attachments={this.get('attachments')}\n ev-$change:attachments={this.onChange}\n />\n ";
|
|
1805
|
-
|
|
1871
|
+
_mount41 = mount(Demo), element = _mount41[1];
|
|
1806
1872
|
file = new File(['hello'], 'hello.txt', {
|
|
1807
1873
|
type: 'text/plain'
|
|
1808
1874
|
});
|
|
1809
1875
|
dispatchEvent(document, 'dragenter', {
|
|
1810
1876
|
dataTransfer: getDataTransfer([file])
|
|
1811
1877
|
});
|
|
1812
|
-
|
|
1878
|
+
_context89.next = 8;
|
|
1813
1879
|
return wait();
|
|
1814
1880
|
case 8:
|
|
1815
1881
|
mask = element.querySelector('.k-sender-drag-mask');
|
|
@@ -1826,7 +1892,7 @@ describe('Sender', function () {
|
|
|
1826
1892
|
dispatchEvent(document, 'drop', {
|
|
1827
1893
|
dataTransfer: getDataTransfer([file])
|
|
1828
1894
|
});
|
|
1829
|
-
|
|
1895
|
+
_context89.next = 22;
|
|
1830
1896
|
return wait();
|
|
1831
1897
|
case 22:
|
|
1832
1898
|
expect(element.querySelector('.k-sender-drag-mask')).to.eql(null);
|
|
@@ -1834,70 +1900,70 @@ describe('Sender', function () {
|
|
|
1834
1900
|
expect(lastAttachments[0].name).to.eql('hello.txt');
|
|
1835
1901
|
case 25:
|
|
1836
1902
|
case "end":
|
|
1837
|
-
return
|
|
1903
|
+
return _context89.stop();
|
|
1838
1904
|
}
|
|
1839
|
-
},
|
|
1905
|
+
}, _callee41);
|
|
1840
1906
|
})));
|
|
1841
|
-
it('should ignore non-file drags when dragFile is enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1842
|
-
var Demo,
|
|
1843
|
-
return _regeneratorRuntime.wrap(function
|
|
1844
|
-
while (1) switch (
|
|
1907
|
+
it('should ignore non-file drags when dragFile is enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42() {
|
|
1908
|
+
var Demo, _mount42, element;
|
|
1909
|
+
return _regeneratorRuntime.wrap(function _callee42$(_context91) {
|
|
1910
|
+
while (1) switch (_context91.prev = _context91.next) {
|
|
1845
1911
|
case 0:
|
|
1846
|
-
Demo = /*#__PURE__*/function (
|
|
1847
|
-
_inheritsLoose(Demo,
|
|
1912
|
+
Demo = /*#__PURE__*/function (_Component42) {
|
|
1913
|
+
_inheritsLoose(Demo, _Component42);
|
|
1848
1914
|
function Demo() {
|
|
1849
|
-
var
|
|
1850
|
-
var
|
|
1851
|
-
for (var
|
|
1852
|
-
args[
|
|
1915
|
+
var _context90;
|
|
1916
|
+
var _this42;
|
|
1917
|
+
for (var _len42 = arguments.length, args = new Array(_len42), _key42 = 0; _key42 < _len42; _key42++) {
|
|
1918
|
+
args[_key42] = arguments[_key42];
|
|
1853
1919
|
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
return
|
|
1920
|
+
_this42 = _Component42.call.apply(_Component42, _concatInstanceProperty(_context90 = [this]).call(_context90, args)) || this;
|
|
1921
|
+
_this42.Sender = Sender;
|
|
1922
|
+
return _this42;
|
|
1857
1923
|
}
|
|
1858
1924
|
return Demo;
|
|
1859
1925
|
}(Component);
|
|
1860
1926
|
Demo.template = "\n const { Sender } = this;\n <Sender dragFile={true} />\n ";
|
|
1861
|
-
|
|
1927
|
+
_mount42 = mount(Demo), element = _mount42[1];
|
|
1862
1928
|
dispatchEvent(document, 'dragenter', {
|
|
1863
1929
|
dataTransfer: {
|
|
1864
1930
|
types: ['text/plain']
|
|
1865
1931
|
}
|
|
1866
1932
|
});
|
|
1867
|
-
|
|
1933
|
+
_context91.next = 6;
|
|
1868
1934
|
return wait();
|
|
1869
1935
|
case 6:
|
|
1870
1936
|
expect(element.querySelector('.k-sender-drag-mask')).to.eql(null);
|
|
1871
1937
|
case 7:
|
|
1872
1938
|
case "end":
|
|
1873
|
-
return
|
|
1939
|
+
return _context91.stop();
|
|
1874
1940
|
}
|
|
1875
|
-
},
|
|
1941
|
+
}, _callee42);
|
|
1876
1942
|
})));
|
|
1877
|
-
it('should trigger uploadError for invalid file type on drag drop', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1878
|
-
var errorMessage, lastAttachments, Demo,
|
|
1879
|
-
return _regeneratorRuntime.wrap(function
|
|
1880
|
-
while (1) switch (
|
|
1943
|
+
it('should trigger uploadError for invalid file type on drag drop', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43() {
|
|
1944
|
+
var errorMessage, lastAttachments, Demo, _mount43, element, file;
|
|
1945
|
+
return _regeneratorRuntime.wrap(function _callee43$(_context93) {
|
|
1946
|
+
while (1) switch (_context93.prev = _context93.next) {
|
|
1881
1947
|
case 0:
|
|
1882
1948
|
errorMessage = '';
|
|
1883
1949
|
lastAttachments = [];
|
|
1884
|
-
Demo = /*#__PURE__*/function (
|
|
1885
|
-
_inheritsLoose(Demo,
|
|
1950
|
+
Demo = /*#__PURE__*/function (_Component43) {
|
|
1951
|
+
_inheritsLoose(Demo, _Component43);
|
|
1886
1952
|
function Demo() {
|
|
1887
|
-
var
|
|
1888
|
-
var
|
|
1889
|
-
for (var
|
|
1890
|
-
args[
|
|
1953
|
+
var _context92;
|
|
1954
|
+
var _this43;
|
|
1955
|
+
for (var _len43 = arguments.length, args = new Array(_len43), _key43 = 0; _key43 < _len43; _key43++) {
|
|
1956
|
+
args[_key43] = arguments[_key43];
|
|
1891
1957
|
}
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1958
|
+
_this43 = _Component43.call.apply(_Component43, _concatInstanceProperty(_context92 = [this]).call(_context92, args)) || this;
|
|
1959
|
+
_this43.Sender = Sender;
|
|
1960
|
+
_this43.onChange = function (items) {
|
|
1895
1961
|
lastAttachments = items;
|
|
1896
1962
|
};
|
|
1897
|
-
|
|
1963
|
+
_this43.onUploadError = function (error) {
|
|
1898
1964
|
errorMessage = error.message;
|
|
1899
1965
|
};
|
|
1900
|
-
return
|
|
1966
|
+
return _this43;
|
|
1901
1967
|
}
|
|
1902
1968
|
Demo.defaults = function defaults() {
|
|
1903
1969
|
return {
|
|
@@ -1907,21 +1973,21 @@ describe('Sender', function () {
|
|
|
1907
1973
|
return Demo;
|
|
1908
1974
|
}(Component);
|
|
1909
1975
|
Demo.template = "\n const { Sender } = this;\n <Sender\n dragFile={true}\n attachments={this.get('attachments')}\n uploadProps={{accept: 'image/*'}}\n ev-$change:attachments={this.onChange}\n ev-uploadError={this.onUploadError}\n />\n ";
|
|
1910
|
-
|
|
1976
|
+
_mount43 = mount(Demo), element = _mount43[1];
|
|
1911
1977
|
file = new File(['hello'], 'hello.txt', {
|
|
1912
1978
|
type: 'text/plain'
|
|
1913
1979
|
});
|
|
1914
1980
|
dispatchEvent(document, 'dragenter', {
|
|
1915
1981
|
dataTransfer: getDataTransfer([file])
|
|
1916
1982
|
});
|
|
1917
|
-
|
|
1983
|
+
_context93.next = 9;
|
|
1918
1984
|
return wait();
|
|
1919
1985
|
case 9:
|
|
1920
1986
|
expect(element.querySelector('.k-sender-drag-mask')).not.to.eql(null);
|
|
1921
1987
|
dispatchEvent(document, 'drop', {
|
|
1922
1988
|
dataTransfer: getDataTransfer([file])
|
|
1923
1989
|
});
|
|
1924
|
-
|
|
1990
|
+
_context93.next = 13;
|
|
1925
1991
|
return wait();
|
|
1926
1992
|
case 13:
|
|
1927
1993
|
expect(errorMessage).to.eql('"hello.txt" 文件类型不合法');
|
|
@@ -1929,30 +1995,30 @@ describe('Sender', function () {
|
|
|
1929
1995
|
expect(element.querySelector('.k-sender-drag-mask')).to.eql(null);
|
|
1930
1996
|
case 16:
|
|
1931
1997
|
case "end":
|
|
1932
|
-
return
|
|
1998
|
+
return _context93.stop();
|
|
1933
1999
|
}
|
|
1934
|
-
},
|
|
2000
|
+
}, _callee43);
|
|
1935
2001
|
})));
|
|
1936
|
-
it('should flatten dragged directory files when uploadProps.directory is enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1937
|
-
var lastAttachments, Demo,
|
|
1938
|
-
return _regeneratorRuntime.wrap(function
|
|
1939
|
-
while (1) switch (
|
|
2002
|
+
it('should flatten dragged directory files when uploadProps.directory is enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44() {
|
|
2003
|
+
var lastAttachments, Demo, _mount44, element, noteFile, imageFile, docsDir;
|
|
2004
|
+
return _regeneratorRuntime.wrap(function _callee44$(_context95) {
|
|
2005
|
+
while (1) switch (_context95.prev = _context95.next) {
|
|
1940
2006
|
case 0:
|
|
1941
2007
|
lastAttachments = [];
|
|
1942
|
-
Demo = /*#__PURE__*/function (
|
|
1943
|
-
_inheritsLoose(Demo,
|
|
2008
|
+
Demo = /*#__PURE__*/function (_Component44) {
|
|
2009
|
+
_inheritsLoose(Demo, _Component44);
|
|
1944
2010
|
function Demo() {
|
|
1945
|
-
var
|
|
1946
|
-
var
|
|
1947
|
-
for (var
|
|
1948
|
-
args[
|
|
2011
|
+
var _context94;
|
|
2012
|
+
var _this44;
|
|
2013
|
+
for (var _len44 = arguments.length, args = new Array(_len44), _key44 = 0; _key44 < _len44; _key44++) {
|
|
2014
|
+
args[_key44] = arguments[_key44];
|
|
1949
2015
|
}
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2016
|
+
_this44 = _Component44.call.apply(_Component44, _concatInstanceProperty(_context94 = [this]).call(_context94, args)) || this;
|
|
2017
|
+
_this44.Sender = Sender;
|
|
2018
|
+
_this44.onChange = function (items) {
|
|
1953
2019
|
lastAttachments = items;
|
|
1954
2020
|
};
|
|
1955
|
-
return
|
|
2021
|
+
return _this44;
|
|
1956
2022
|
}
|
|
1957
2023
|
Demo.defaults = function defaults() {
|
|
1958
2024
|
return {
|
|
@@ -1962,7 +2028,7 @@ describe('Sender', function () {
|
|
|
1962
2028
|
return Demo;
|
|
1963
2029
|
}(Component);
|
|
1964
2030
|
Demo.template = "\n const { Sender } = this;\n <Sender\n dragFile={true}\n attachments={this.get('attachments')}\n uploadProps={{directory: true}}\n ev-$change:attachments={this.onChange}\n />\n ";
|
|
1965
|
-
|
|
2031
|
+
_mount44 = mount(Demo), element = _mount44[1];
|
|
1966
2032
|
noteFile = new File(['note'], 'note.txt', {
|
|
1967
2033
|
type: 'text/plain'
|
|
1968
2034
|
});
|
|
@@ -1973,14 +2039,14 @@ describe('Sender', function () {
|
|
|
1973
2039
|
dispatchEvent(document, 'dragenter', {
|
|
1974
2040
|
dataTransfer: getDataTransfer([noteFile])
|
|
1975
2041
|
});
|
|
1976
|
-
|
|
2042
|
+
_context95.next = 10;
|
|
1977
2043
|
return wait();
|
|
1978
2044
|
case 10:
|
|
1979
2045
|
expect(element.querySelector('.k-sender-drag-mask')).not.to.eql(null);
|
|
1980
2046
|
dispatchEvent(document, 'drop', {
|
|
1981
2047
|
dataTransfer: getDataTransferWithEntries([docsDir])
|
|
1982
2048
|
});
|
|
1983
|
-
|
|
2049
|
+
_context95.next = 14;
|
|
1984
2050
|
return wait(20);
|
|
1985
2051
|
case 14:
|
|
1986
2052
|
expect(lastAttachments.length).to.eql(2);
|
|
@@ -1993,34 +2059,34 @@ describe('Sender', function () {
|
|
|
1993
2059
|
expect(element.querySelector('.k-sender-drag-mask')).to.eql(null);
|
|
1994
2060
|
case 18:
|
|
1995
2061
|
case "end":
|
|
1996
|
-
return
|
|
2062
|
+
return _context95.stop();
|
|
1997
2063
|
}
|
|
1998
|
-
},
|
|
2064
|
+
}, _callee44);
|
|
1999
2065
|
})));
|
|
2000
|
-
it('should still validate flattened directory files on drag drop', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2001
|
-
var errorMessage, lastAttachments, Demo,
|
|
2002
|
-
return _regeneratorRuntime.wrap(function
|
|
2003
|
-
while (1) switch (
|
|
2066
|
+
it('should still validate flattened directory files on drag drop', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45() {
|
|
2067
|
+
var errorMessage, lastAttachments, Demo, _mount45, element, file, docsDir;
|
|
2068
|
+
return _regeneratorRuntime.wrap(function _callee45$(_context97) {
|
|
2069
|
+
while (1) switch (_context97.prev = _context97.next) {
|
|
2004
2070
|
case 0:
|
|
2005
2071
|
errorMessage = '';
|
|
2006
2072
|
lastAttachments = [];
|
|
2007
|
-
Demo = /*#__PURE__*/function (
|
|
2008
|
-
_inheritsLoose(Demo,
|
|
2073
|
+
Demo = /*#__PURE__*/function (_Component45) {
|
|
2074
|
+
_inheritsLoose(Demo, _Component45);
|
|
2009
2075
|
function Demo() {
|
|
2010
|
-
var
|
|
2011
|
-
var
|
|
2012
|
-
for (var
|
|
2013
|
-
args[
|
|
2076
|
+
var _context96;
|
|
2077
|
+
var _this45;
|
|
2078
|
+
for (var _len45 = arguments.length, args = new Array(_len45), _key45 = 0; _key45 < _len45; _key45++) {
|
|
2079
|
+
args[_key45] = arguments[_key45];
|
|
2014
2080
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2081
|
+
_this45 = _Component45.call.apply(_Component45, _concatInstanceProperty(_context96 = [this]).call(_context96, args)) || this;
|
|
2082
|
+
_this45.Sender = Sender;
|
|
2083
|
+
_this45.onChange = function (items) {
|
|
2018
2084
|
lastAttachments = items;
|
|
2019
2085
|
};
|
|
2020
|
-
|
|
2086
|
+
_this45.onUploadError = function (error) {
|
|
2021
2087
|
errorMessage = error.message;
|
|
2022
2088
|
};
|
|
2023
|
-
return
|
|
2089
|
+
return _this45;
|
|
2024
2090
|
}
|
|
2025
2091
|
Demo.defaults = function defaults() {
|
|
2026
2092
|
return {
|
|
@@ -2030,7 +2096,7 @@ describe('Sender', function () {
|
|
|
2030
2096
|
return Demo;
|
|
2031
2097
|
}(Component);
|
|
2032
2098
|
Demo.template = "\n const { Sender } = this;\n <Sender\n dragFile={true}\n attachments={this.get('attachments')}\n uploadProps={{directory: true, accept: 'image/*'}}\n ev-$change:attachments={this.onChange}\n ev-uploadError={this.onUploadError}\n />\n ";
|
|
2033
|
-
|
|
2099
|
+
_mount45 = mount(Demo), element = _mount45[1];
|
|
2034
2100
|
file = new File(['hello'], 'hello.txt', {
|
|
2035
2101
|
type: 'text/plain'
|
|
2036
2102
|
});
|
|
@@ -2038,14 +2104,14 @@ describe('Sender', function () {
|
|
|
2038
2104
|
dispatchEvent(document, 'dragenter', {
|
|
2039
2105
|
dataTransfer: getDataTransfer([file])
|
|
2040
2106
|
});
|
|
2041
|
-
|
|
2107
|
+
_context97.next = 10;
|
|
2042
2108
|
return wait();
|
|
2043
2109
|
case 10:
|
|
2044
2110
|
expect(element.querySelector('.k-sender-drag-mask')).not.to.eql(null);
|
|
2045
2111
|
dispatchEvent(document, 'drop', {
|
|
2046
2112
|
dataTransfer: getDataTransferWithEntries([docsDir])
|
|
2047
2113
|
});
|
|
2048
|
-
|
|
2114
|
+
_context97.next = 14;
|
|
2049
2115
|
return wait(20);
|
|
2050
2116
|
case 14:
|
|
2051
2117
|
expect(errorMessage).to.eql('"hello.txt" 文件类型不合法');
|
|
@@ -2053,30 +2119,30 @@ describe('Sender', function () {
|
|
|
2053
2119
|
expect(element.querySelector('.k-sender-drag-mask')).to.eql(null);
|
|
2054
2120
|
case 17:
|
|
2055
2121
|
case "end":
|
|
2056
|
-
return
|
|
2122
|
+
return _context97.stop();
|
|
2057
2123
|
}
|
|
2058
|
-
},
|
|
2124
|
+
}, _callee45);
|
|
2059
2125
|
})));
|
|
2060
|
-
it('should add pasted files when pasteFile is enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2061
|
-
var lastAttachments, Demo,
|
|
2062
|
-
return _regeneratorRuntime.wrap(function
|
|
2063
|
-
while (1) switch (
|
|
2126
|
+
it('should add pasted files when pasteFile is enabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46() {
|
|
2127
|
+
var lastAttachments, Demo, _mount46, element, textarea, file;
|
|
2128
|
+
return _regeneratorRuntime.wrap(function _callee46$(_context99) {
|
|
2129
|
+
while (1) switch (_context99.prev = _context99.next) {
|
|
2064
2130
|
case 0:
|
|
2065
2131
|
lastAttachments = [];
|
|
2066
|
-
Demo = /*#__PURE__*/function (
|
|
2067
|
-
_inheritsLoose(Demo,
|
|
2132
|
+
Demo = /*#__PURE__*/function (_Component46) {
|
|
2133
|
+
_inheritsLoose(Demo, _Component46);
|
|
2068
2134
|
function Demo() {
|
|
2069
|
-
var
|
|
2070
|
-
var
|
|
2071
|
-
for (var
|
|
2072
|
-
args[
|
|
2135
|
+
var _context98;
|
|
2136
|
+
var _this46;
|
|
2137
|
+
for (var _len46 = arguments.length, args = new Array(_len46), _key46 = 0; _key46 < _len46; _key46++) {
|
|
2138
|
+
args[_key46] = arguments[_key46];
|
|
2073
2139
|
}
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2140
|
+
_this46 = _Component46.call.apply(_Component46, _concatInstanceProperty(_context98 = [this]).call(_context98, args)) || this;
|
|
2141
|
+
_this46.Sender = Sender;
|
|
2142
|
+
_this46.onChange = function (items) {
|
|
2077
2143
|
lastAttachments = items;
|
|
2078
2144
|
};
|
|
2079
|
-
return
|
|
2145
|
+
return _this46;
|
|
2080
2146
|
}
|
|
2081
2147
|
Demo.defaults = function defaults() {
|
|
2082
2148
|
return {
|
|
@@ -2086,7 +2152,7 @@ describe('Sender', function () {
|
|
|
2086
2152
|
return Demo;
|
|
2087
2153
|
}(Component);
|
|
2088
2154
|
Demo.template = "\n const { Sender } = this;\n <Sender\n pasteFile={true}\n attachments={this.get('attachments')}\n ev-$change:attachments={this.onChange}\n />\n ";
|
|
2089
|
-
|
|
2155
|
+
_mount46 = mount(Demo), element = _mount46[1];
|
|
2090
2156
|
textarea = element.querySelector('.k-sender-input');
|
|
2091
2157
|
file = new File(['image'], 'cover.png', {
|
|
2092
2158
|
type: 'image/png'
|
|
@@ -2094,41 +2160,41 @@ describe('Sender', function () {
|
|
|
2094
2160
|
dispatchEvent(textarea, 'paste', {
|
|
2095
2161
|
clipboardData: getClipboardData([file])
|
|
2096
2162
|
});
|
|
2097
|
-
|
|
2163
|
+
_context99.next = 9;
|
|
2098
2164
|
return wait();
|
|
2099
2165
|
case 9:
|
|
2100
2166
|
expect(lastAttachments.length).to.eql(1);
|
|
2101
2167
|
expect(lastAttachments[0].name).to.eql('cover.png');
|
|
2102
2168
|
case 11:
|
|
2103
2169
|
case "end":
|
|
2104
|
-
return
|
|
2170
|
+
return _context99.stop();
|
|
2105
2171
|
}
|
|
2106
|
-
},
|
|
2172
|
+
}, _callee46);
|
|
2107
2173
|
})));
|
|
2108
|
-
it('should trigger uploadError for invalid file type on paste', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2109
|
-
var errorMessage, lastAttachments, Demo,
|
|
2110
|
-
return _regeneratorRuntime.wrap(function
|
|
2111
|
-
while (1) switch (
|
|
2174
|
+
it('should trigger uploadError for invalid file type on paste', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47() {
|
|
2175
|
+
var errorMessage, lastAttachments, Demo, _mount47, element, textarea, file;
|
|
2176
|
+
return _regeneratorRuntime.wrap(function _callee47$(_context101) {
|
|
2177
|
+
while (1) switch (_context101.prev = _context101.next) {
|
|
2112
2178
|
case 0:
|
|
2113
2179
|
errorMessage = '';
|
|
2114
2180
|
lastAttachments = [];
|
|
2115
|
-
Demo = /*#__PURE__*/function (
|
|
2116
|
-
_inheritsLoose(Demo,
|
|
2181
|
+
Demo = /*#__PURE__*/function (_Component47) {
|
|
2182
|
+
_inheritsLoose(Demo, _Component47);
|
|
2117
2183
|
function Demo() {
|
|
2118
|
-
var
|
|
2119
|
-
var
|
|
2120
|
-
for (var
|
|
2121
|
-
args[
|
|
2184
|
+
var _context100;
|
|
2185
|
+
var _this47;
|
|
2186
|
+
for (var _len47 = arguments.length, args = new Array(_len47), _key47 = 0; _key47 < _len47; _key47++) {
|
|
2187
|
+
args[_key47] = arguments[_key47];
|
|
2122
2188
|
}
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2189
|
+
_this47 = _Component47.call.apply(_Component47, _concatInstanceProperty(_context100 = [this]).call(_context100, args)) || this;
|
|
2190
|
+
_this47.Sender = Sender;
|
|
2191
|
+
_this47.onChange = function (items) {
|
|
2126
2192
|
lastAttachments = items;
|
|
2127
2193
|
};
|
|
2128
|
-
|
|
2194
|
+
_this47.onUploadError = function (error) {
|
|
2129
2195
|
errorMessage = error.message;
|
|
2130
2196
|
};
|
|
2131
|
-
return
|
|
2197
|
+
return _this47;
|
|
2132
2198
|
}
|
|
2133
2199
|
Demo.defaults = function defaults() {
|
|
2134
2200
|
return {
|
|
@@ -2138,7 +2204,7 @@ describe('Sender', function () {
|
|
|
2138
2204
|
return Demo;
|
|
2139
2205
|
}(Component);
|
|
2140
2206
|
Demo.template = "\n const { Sender } = this;\n <Sender\n pasteFile={true}\n attachments={this.get('attachments')}\n uploadProps={{accept: 'image/*'}}\n ev-$change:attachments={this.onChange}\n ev-uploadError={this.onUploadError}\n />\n ";
|
|
2141
|
-
|
|
2207
|
+
_mount47 = mount(Demo), element = _mount47[1];
|
|
2142
2208
|
textarea = element.querySelector('.k-sender-input');
|
|
2143
2209
|
file = new File(['hello'], 'hello.txt', {
|
|
2144
2210
|
type: 'text/plain'
|
|
@@ -2146,38 +2212,38 @@ describe('Sender', function () {
|
|
|
2146
2212
|
dispatchEvent(textarea, 'paste', {
|
|
2147
2213
|
clipboardData: getClipboardData([file])
|
|
2148
2214
|
});
|
|
2149
|
-
|
|
2215
|
+
_context101.next = 10;
|
|
2150
2216
|
return wait();
|
|
2151
2217
|
case 10:
|
|
2152
2218
|
expect(errorMessage).to.eql('"hello.txt" 文件类型不合法');
|
|
2153
2219
|
expect(lastAttachments.length).to.eql(0);
|
|
2154
2220
|
case 12:
|
|
2155
2221
|
case "end":
|
|
2156
|
-
return
|
|
2222
|
+
return _context101.stop();
|
|
2157
2223
|
}
|
|
2158
|
-
},
|
|
2224
|
+
}, _callee47);
|
|
2159
2225
|
})));
|
|
2160
|
-
it('should keep native text paste when pasteFile is disabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
2161
|
-
var Demo,
|
|
2162
|
-
return _regeneratorRuntime.wrap(function
|
|
2163
|
-
while (1) switch (
|
|
2226
|
+
it('should keep native text paste when pasteFile is disabled', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48() {
|
|
2227
|
+
var Demo, _mount48, element, textarea, file, event;
|
|
2228
|
+
return _regeneratorRuntime.wrap(function _callee48$(_context103) {
|
|
2229
|
+
while (1) switch (_context103.prev = _context103.next) {
|
|
2164
2230
|
case 0:
|
|
2165
|
-
Demo = /*#__PURE__*/function (
|
|
2166
|
-
_inheritsLoose(Demo,
|
|
2231
|
+
Demo = /*#__PURE__*/function (_Component48) {
|
|
2232
|
+
_inheritsLoose(Demo, _Component48);
|
|
2167
2233
|
function Demo() {
|
|
2168
|
-
var
|
|
2169
|
-
var
|
|
2170
|
-
for (var
|
|
2171
|
-
args[
|
|
2234
|
+
var _context102;
|
|
2235
|
+
var _this48;
|
|
2236
|
+
for (var _len48 = arguments.length, args = new Array(_len48), _key48 = 0; _key48 < _len48; _key48++) {
|
|
2237
|
+
args[_key48] = arguments[_key48];
|
|
2172
2238
|
}
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
return
|
|
2239
|
+
_this48 = _Component48.call.apply(_Component48, _concatInstanceProperty(_context102 = [this]).call(_context102, args)) || this;
|
|
2240
|
+
_this48.Sender = Sender;
|
|
2241
|
+
return _this48;
|
|
2176
2242
|
}
|
|
2177
2243
|
return Demo;
|
|
2178
2244
|
}(Component);
|
|
2179
2245
|
Demo.template = "\n const { Sender } = this;\n <Sender />\n ";
|
|
2180
|
-
|
|
2246
|
+
_mount48 = mount(Demo), element = _mount48[1];
|
|
2181
2247
|
textarea = element.querySelector('.k-sender-input');
|
|
2182
2248
|
file = new File(['image'], 'cover.png', {
|
|
2183
2249
|
type: 'image/png'
|
|
@@ -2188,14 +2254,14 @@ describe('Sender', function () {
|
|
|
2188
2254
|
clipboardData: getClipboardData([file])
|
|
2189
2255
|
});
|
|
2190
2256
|
textarea.dispatchEvent(event);
|
|
2191
|
-
|
|
2257
|
+
_context103.next = 11;
|
|
2192
2258
|
return wait();
|
|
2193
2259
|
case 11:
|
|
2194
2260
|
expect(event.defaultPrevented).to.eql(false);
|
|
2195
2261
|
case 12:
|
|
2196
2262
|
case "end":
|
|
2197
|
-
return
|
|
2263
|
+
return _context103.stop();
|
|
2198
2264
|
}
|
|
2199
|
-
},
|
|
2265
|
+
}, _callee48);
|
|
2200
2266
|
})));
|
|
2201
2267
|
});
|