@salesforce/design-system-react 0.10.50-alpha.1 → 0.10.50
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/accordion/__tests__/accordion.browser-test.jsx +302 -0
- package/components/alert/__tests__/alert.browser-test.jsx +100 -0
- package/components/app-launcher/__tests__/app-launcher.browser-test.jsx +228 -0
- package/components/app-launcher/__tests__/expandable-section.browser-test.jsx +144 -0
- package/components/app-launcher/__tests__/link.browser-test.jsx +107 -0
- package/components/app-launcher/__tests__/tile.browser-test.jsx +267 -0
- package/components/avatar/__tests__/avatar.browser-test.jsx +207 -0
- package/components/builder-header/__tests__/builder-header.browser-test.jsx +53 -0
- package/components/button/__tests__/button.browser-test.jsx +226 -0
- package/components/button-group/__tests__/button-group.browser-test.jsx +144 -0
- package/components/button-stateful/__tests__/button-stateful.browser-test.jsx +125 -0
- package/components/card/__tests__/card.browser-test.jsx +255 -0
- package/components/carousel/__tests__/carousel.browser-test.jsx +527 -0
- package/components/color-picker/__tests__/color-picker.browser-test.jsx +767 -0
- package/components/combobox/__tests__/combobox.browser-test.jsx +654 -0
- package/components/data-table/__tests__/data-table.browser-test.jsx +1051 -0
- package/components/date-picker/__tests__/__snapshots__/datepicker.dom-snapshot-test.jsx.snap +4429 -0
- package/components/date-picker/__tests__/date-picker.browser-test.jsx +497 -0
- package/components/date-picker/__tests__/datepicker.dom-snapshot-test.jsx +109 -0
- package/components/docked-composer/__tests__/docked-composer.browser-test.jsx +83 -0
- package/components/expandable-section/__tests__/expandable-section.browser-test.jsx +133 -0
- package/components/expression/__tests__/expression.browser-test.jsx +255 -0
- package/components/filter/__tests__/filter.browser-test.jsx +147 -0
- package/components/forms/input/__tests__/inline.browser-test.jsx +164 -0
- package/components/global-header/__tests__/global-header.browser-test.jsx +177 -0
- package/components/global-navigation-bar/__tests__/global-navigation-bar.browser-test.jsx +464 -0
- package/components/icon/__tests__/icon.browser-test.jsx +214 -0
- package/components/illustration/__tests__/illustration.browser-test.jsx +177 -0
- package/components/input/__tests__/input.browser-test.jsx +612 -0
- package/components/location-map/__tests__/location-map.browser-test.jsx +158 -0
- package/components/lookup/__tests__/lookup.browser-test.jsx +353 -0
- package/components/media-object/__tests__/media-object.browser-test.jsx +87 -0
- package/components/menu-dropdown/__tests__/dropdown.browser-test.jsx +588 -0
- package/components/menu-picklist/__tests__/menupicklist.snapshot-old-test.jsx +41 -0
- package/components/menu-picklist/__tests__/picklist-base.browser-test.jsx +275 -0
- package/components/modal/__tests__/modal.browser-test.jsx +333 -0
- package/components/notification/__tests__/notification.browser-test.jsx +113 -0
- package/components/page-header/__tests__/page-header.browser-test.jsx +161 -0
- package/components/panel/__tests__/__snapshots__/filtering.dom-snapshot-test.jsx.snap +298 -0
- package/components/panel/__tests__/filtering.dom-snapshot-test.jsx +9 -0
- package/components/pill/__tests__/pill.browser-test.jsx +308 -0
- package/components/pill-container/__tests__/pill-container.browser-test.jsx +186 -0
- package/components/popover/__tests__/popover.browser-test.jsx +327 -0
- package/components/progress-indicator/__tests__/progress-indicator.browser-test.jsx +335 -0
- package/components/radio-button-group/__tests__/radio-button-group.browser-test.jsx +122 -0
- package/components/radio-group/__tests__/radio-group.browser-test.jsx +119 -0
- package/components/setup-assistant/__tests__/setup-assistant.browser-test.jsx +77 -0
- package/components/slider/__tests__/slider.browser-test.jsx +389 -0
- package/components/spinner/__tests__/spinner.browser-test.jsx +57 -0
- package/components/split-view/__tests__/split-view.listbox.browser-test.jsx +225 -0
- package/components/split-view/__tests__/split-view.listbox.header.browser-test.jsx +158 -0
- package/components/split-view/__tests__/split-view.listbox.unread.browser-test.jsx +114 -0
- package/components/tabs/__tests__/tabs.browser-test.jsx +458 -0
- package/components/textarea/__tests__/textarea.browser-test.jsx +175 -0
- package/components/time-picker/__tests__/time-picker.browser-test.jsx +46 -0
- package/components/toast/__tests__/toast.browser-test.jsx +118 -0
- package/components/tooltip/__tests__/tooltip.browser-test.jsx +214 -0
- package/components/tree/__tests__/tree.browser-test.jsx +303 -0
- package/components/vertical-navigation/__tests__/navigation.browser-test.jsx +117 -0
- package/components/visual-picker/__tests__/visual-picker.browser-test.jsx +288 -0
- package/components/welcome-mat/__tests__/welcome-mat.browser-test.jsx +358 -0
- package/design-system-react-components.js +1 -1
- package/design-system-react-components.min.js.LICENSE.txt +1 -1
- package/design-system-react.js +1 -1
- package/design-system-react.min.js.LICENSE.txt +1 -1
- package/lib/design-system-react-components.min.js.LICENSE.txt +1 -1
- package/lib/design-system-react.min.js.LICENSE.txt +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import chai from 'chai';
|
|
4
|
+
import assign from 'lodash.assign';
|
|
5
|
+
|
|
6
|
+
import IconSettings from '../../icon-settings';
|
|
7
|
+
import AppLauncherLink from '../../app-launcher/link';
|
|
8
|
+
import AppLauncherTile from '../../app-launcher/tile';
|
|
9
|
+
import AppLauncherExpandableSection from '../../app-launcher/expandable-section';
|
|
10
|
+
|
|
11
|
+
const { expect } = chai;
|
|
12
|
+
const should = chai.should();
|
|
13
|
+
|
|
14
|
+
describe('SLDS APP LAUNCHER EXPANDABLE SECTION *******************************************', () => {
|
|
15
|
+
const handles = {
|
|
16
|
+
section: null,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const defaultSectionProps = {
|
|
20
|
+
title: 'All Items',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const defaultChildren = [
|
|
24
|
+
<AppLauncherTile key="asdf" title="Marketing Cloud" />,
|
|
25
|
+
<AppLauncherTile key="qwer" title="Support Cloud" />,
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const linkChildren = [
|
|
29
|
+
<AppLauncherLink key="asdf">Accounts</AppLauncherLink>,
|
|
30
|
+
<AppLauncherLink key="qwer">Ammnouncements</AppLauncherLink>,
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const createSection = (props, children) =>
|
|
34
|
+
React.createElement(
|
|
35
|
+
AppLauncherExpandableSection,
|
|
36
|
+
assign({}, defaultSectionProps, props),
|
|
37
|
+
children
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
function mountSection(props, children = defaultChildren) {
|
|
41
|
+
handles.section = mount(
|
|
42
|
+
<IconSettings iconPath="/assets/icons">
|
|
43
|
+
{createSection(props, children)}
|
|
44
|
+
</IconSettings>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
describe('App Launcher Expandable Section', () => {
|
|
49
|
+
let onToggleOpen;
|
|
50
|
+
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
onToggleOpen = sinon.spy();
|
|
53
|
+
|
|
54
|
+
mountSection({
|
|
55
|
+
assistiveText: { toggleSection: 'Collapse Section' },
|
|
56
|
+
onToggleOpen,
|
|
57
|
+
title: 'ALL THE ITEMS!',
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('section exists', () => {
|
|
62
|
+
should.exist(handles.section);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('section has "slds-is-open" class when open', () => {
|
|
66
|
+
expect(handles.section.find('.slds-section')).to.have.className(
|
|
67
|
+
'slds-is-open'
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('section has a title', () => {
|
|
72
|
+
should.exist(handles.section.find('.slds-section__title'));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('ul has proper classes', () => {
|
|
76
|
+
should.exist(
|
|
77
|
+
handles.section.find('ul.slds-grid.slds-grid_pull-padded.slds-wrap')
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('li exists', () => {
|
|
82
|
+
expect(handles.section.find('li').length).to.equal(2);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('renders li with proper classes', () => {
|
|
86
|
+
const li = handles.section.find('li').at(0);
|
|
87
|
+
expect(li).to.have.className('slds-p-horizontal_small');
|
|
88
|
+
expect(li).to.have.className('slds-size_1-of-1');
|
|
89
|
+
expect(li).to.have.className('slds-medium-size_1-of-3');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('renders custom section title', () => {
|
|
93
|
+
expect(handles.section.find('h3 .slds-truncate').text()).to.equal(
|
|
94
|
+
'ALL THE ITEMS!'
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('renders custom toggle assistve text', () => {
|
|
99
|
+
expect(
|
|
100
|
+
handles.section.find('h3 span.slds-assistive-text').text()
|
|
101
|
+
).to.equal('Collapse Section');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('toggling section fires callback', () => {
|
|
105
|
+
handles.section.find('h3 button.slds-button').simulate('click');
|
|
106
|
+
expect(onToggleOpen.calledOnce).to.be.true; // eslint-disable-line no-unused-expressions
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('App Launcher Expandable Section (non-collapsible) with links', () => {
|
|
111
|
+
beforeEach(() => {
|
|
112
|
+
mountSection({ nonCollapsible: true }, linkChildren);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('does not render toggle if non-collapsible is true', () => {
|
|
116
|
+
should.not.exist(
|
|
117
|
+
handles.section.find(
|
|
118
|
+
'.slds-button .slds-button_icon .slds-m-right_small'
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('renders li with proper classes', () => {
|
|
124
|
+
const li = handles.section.find('li').at(0);
|
|
125
|
+
expect(li).to.have.className('slds-col_padded');
|
|
126
|
+
expect(li).to.have.className('slds-p-vertical_xx-small');
|
|
127
|
+
expect(li).to.have.className('slds-size_1-of-5');
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe('App Launcher Expandable Section (closed)', () => {
|
|
132
|
+
beforeEach(() => {
|
|
133
|
+
mountSection({
|
|
134
|
+
isOpen: false,
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('section does not have "slds-is-open" class when closed', () => {
|
|
139
|
+
expect(handles.section.find('.slds-section.slds-is-open').length).to.eql(
|
|
140
|
+
0
|
|
141
|
+
);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import chai from 'chai';
|
|
4
|
+
import IconSettings from '../../icon-settings';
|
|
5
|
+
|
|
6
|
+
import AppLauncherLink from '../../app-launcher/link';
|
|
7
|
+
|
|
8
|
+
const { expect } = chai;
|
|
9
|
+
const should = chai.should();
|
|
10
|
+
|
|
11
|
+
describe('SLDS APP LAUNCHER LINK *******************************************', () => {
|
|
12
|
+
let div;
|
|
13
|
+
|
|
14
|
+
const handles = {
|
|
15
|
+
link: null,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const createLink = (props) => React.createElement(AppLauncherLink, props);
|
|
19
|
+
|
|
20
|
+
function mountLink(props) {
|
|
21
|
+
div = document.createElement('div');
|
|
22
|
+
document.body.appendChild(div);
|
|
23
|
+
|
|
24
|
+
handles.link = mount(
|
|
25
|
+
<IconSettings iconPath="/assets/icons">{createLink(props)}</IconSettings>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function cleanDom() {
|
|
30
|
+
document.body.removeChild(div);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe('Default App Launcher Link', () => {
|
|
34
|
+
let onClick;
|
|
35
|
+
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
onClick = sinon.spy();
|
|
38
|
+
|
|
39
|
+
mountLink({
|
|
40
|
+
children: 'Accounts',
|
|
41
|
+
className: 'this-is-a-custom-class',
|
|
42
|
+
href: 'https://www.salesforce.com/',
|
|
43
|
+
onClick,
|
|
44
|
+
search: 'ccounts',
|
|
45
|
+
title: 'Accounts Title',
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
afterEach(() => {
|
|
50
|
+
cleanDom();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('renders link', () => {
|
|
54
|
+
should.exist(handles.link);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('renders link with proper classes', () => {
|
|
58
|
+
should.exist(handles.link.find('a.slds-truncate'));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('renders link with custom classes', () => {
|
|
62
|
+
should.exist(handles.link.find('a.this-is-a-custom-class'));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('renders link children', () => {
|
|
66
|
+
expect(handles.link.find('span').at(0).text()).to.eql('Accounts');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('renders link title', () => {
|
|
70
|
+
expect(handles.link).to.have.attr('title', 'Accounts Title');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('has an href attribute', () => {
|
|
74
|
+
expect(handles.link).to.have.attr('href', 'https://www.salesforce.com/');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('clicking link fires callback and ignores href', () => {
|
|
78
|
+
handles.link.simulate('click');
|
|
79
|
+
expect(onClick.calledOnce).to.be.true; // eslint-disable-line no-unused-expressions
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('search string highlights link children', () => {
|
|
83
|
+
expect(
|
|
84
|
+
handles.link.containsAllMatchingElements(
|
|
85
|
+
// eslint-disable-line no-unused-expressions
|
|
86
|
+
[<span>A</span>, <mark>ccounts</mark>]
|
|
87
|
+
)
|
|
88
|
+
).to.be.true;
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe('App Launcher Link (title prop not provided)', () => {
|
|
93
|
+
beforeEach(() => {
|
|
94
|
+
mountLink({
|
|
95
|
+
children: 'Accounts',
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
afterEach(() => {
|
|
100
|
+
cleanDom();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('uses children to render title when not provided title prop', () => {
|
|
104
|
+
expect(handles.link).to.have.attr('title', 'Accounts');
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import chai from 'chai';
|
|
4
|
+
import assign from 'lodash.assign';
|
|
5
|
+
import IconSettings from '../../icon-settings';
|
|
6
|
+
|
|
7
|
+
import AppLauncherTile from '../../app-launcher/tile';
|
|
8
|
+
import Icon from '../../icon';
|
|
9
|
+
|
|
10
|
+
const { expect } = chai;
|
|
11
|
+
const should = chai.should();
|
|
12
|
+
|
|
13
|
+
describe('SLDS APP LAUNCHER TILE *******************************************', () => {
|
|
14
|
+
let div;
|
|
15
|
+
|
|
16
|
+
const handles = {
|
|
17
|
+
body: null,
|
|
18
|
+
description: null,
|
|
19
|
+
icon: null,
|
|
20
|
+
more: null,
|
|
21
|
+
tile: null,
|
|
22
|
+
title: null,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const defaultTileProps = {
|
|
26
|
+
title: 'Marketing Cloud',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const createTile = (props) =>
|
|
30
|
+
React.createElement(AppLauncherTile, assign({}, defaultTileProps, props));
|
|
31
|
+
|
|
32
|
+
function mountTile(props) {
|
|
33
|
+
// This div is needed for Truncate to properly determine the description width
|
|
34
|
+
div = document.createElement('div');
|
|
35
|
+
div.style.cssText = 'width: 300px';
|
|
36
|
+
document.body.appendChild(div);
|
|
37
|
+
|
|
38
|
+
handles.tile = mount(
|
|
39
|
+
<IconSettings iconPath="/assets/icons">{createTile(props)}</IconSettings>,
|
|
40
|
+
{ attachTo: div }
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
handles.body = handles.tile.find('.slds-app-launcher__tile-body');
|
|
44
|
+
handles.description = handles.body.find('div').at(1);
|
|
45
|
+
handles.icon = handles.tile.find('.slds-app-launcher__tile-figure');
|
|
46
|
+
handles.more = handles.tile.find(
|
|
47
|
+
'.slds-app-launcher__tile-body button.slds-button_reset'
|
|
48
|
+
);
|
|
49
|
+
handles.title = handles.tile
|
|
50
|
+
.find('.slds-app-launcher__tile-body')
|
|
51
|
+
.childAt(0);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function cleanDom() {
|
|
55
|
+
document.body.removeChild(div);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
describe('Default App Launcher Tile', () => {
|
|
59
|
+
let onClick;
|
|
60
|
+
|
|
61
|
+
beforeEach(() => {
|
|
62
|
+
onClick = sinon.spy();
|
|
63
|
+
|
|
64
|
+
mountTile({
|
|
65
|
+
className: 'this-is-a-custom-class',
|
|
66
|
+
description: 'Fluffy support',
|
|
67
|
+
href: 'https://www.salesforce.com/',
|
|
68
|
+
onClick,
|
|
69
|
+
search: 'upport',
|
|
70
|
+
title: 'Support Cloud',
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
afterEach(() => {
|
|
75
|
+
cleanDom();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('renders tile', () => {
|
|
79
|
+
should.exist(handles.tile);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('renders tile with proper classes', () => {
|
|
83
|
+
should.exist(
|
|
84
|
+
handles.tile.find('.slds-app-launcher__tile.slds-text-link_reset')
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('renders tile body', () => {
|
|
89
|
+
should.exist(handles.body);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('renders tile title', () => {
|
|
93
|
+
should.exist(handles.title);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('renders custom title', () => {
|
|
97
|
+
expect(handles.title.text()).to.equal('Support Cloud');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('renders custom app description', () => {
|
|
101
|
+
// the .at(1) would only apply when descriptionHeading is set
|
|
102
|
+
expect(handles.description.find('span').at(1).text()).to.equal(
|
|
103
|
+
'Fluffy support'
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('has an href attribute', () => {
|
|
108
|
+
expect(handles.tile.find('a')).to.have.attr(
|
|
109
|
+
'href',
|
|
110
|
+
'https://www.salesforce.com/'
|
|
111
|
+
);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('clicking tile fires callback', () => {
|
|
115
|
+
handles.tile.simulate('click');
|
|
116
|
+
expect(onClick.calledOnce).to.be.true; // eslint-disable-line no-unused-expressions
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('clicking tile title link fires callback and ignores href', () => {
|
|
120
|
+
handles.body.find('a').at(0).simulate('click');
|
|
121
|
+
expect(onClick.calledOnce).to.be.true; // eslint-disable-line no-unused-expressions
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('tile can be passed custom className', () => {
|
|
125
|
+
should.exist(handles.tile.find('.this-is-a-custom-class'));
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('tile can be passed a search string', () => {
|
|
129
|
+
const searchStr = handles.tile;
|
|
130
|
+
const childrenProps = searchStr.props().children.props;
|
|
131
|
+
expect(childrenProps.search).to.equal('upport');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('search string highlights title', () => {
|
|
135
|
+
expect(
|
|
136
|
+
handles.title.containsAllMatchingElements(
|
|
137
|
+
// eslint-disable-line no-unused-expressions
|
|
138
|
+
[<span>S</span>, <mark>upport</mark>, <span> Cloud</span>]
|
|
139
|
+
)
|
|
140
|
+
).to.be.true;
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('search string highlights description', () => {
|
|
144
|
+
expect(
|
|
145
|
+
handles.description.containsAllMatchingElements(
|
|
146
|
+
// eslint-disable-line no-unused-expressions
|
|
147
|
+
[<span>Fluffy s</span>, <mark>upport</mark>]
|
|
148
|
+
)
|
|
149
|
+
).to.be.true;
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
describe('App Launcher Tile (truncated)', () => {
|
|
154
|
+
const description =
|
|
155
|
+
'The key to call center and contact center management is more simple than you think with this amazing application!';
|
|
156
|
+
|
|
157
|
+
const moreLabel = 'MORE!';
|
|
158
|
+
|
|
159
|
+
beforeEach(() => {
|
|
160
|
+
mountTile({
|
|
161
|
+
title: 'Call Center',
|
|
162
|
+
description,
|
|
163
|
+
isOpenTooltip: true,
|
|
164
|
+
moreLabel,
|
|
165
|
+
search: 'enter',
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
afterEach((done) => {
|
|
170
|
+
setTimeout(function timeoutFunction() {
|
|
171
|
+
cleanDom();
|
|
172
|
+
done();
|
|
173
|
+
}, 100);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('renders more link', () => {
|
|
177
|
+
should.exist(handles.more);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('renders custom more link', () => {
|
|
181
|
+
// Enzyme is unable to find React inserted `<span>` tags due to text wrapping. Therefore the DOM transversal.
|
|
182
|
+
// const clonedNode = handles.more.node.cloneNode();
|
|
183
|
+
// const clonedNodeWithoutSpan = clonedNode.firstChild.remove();
|
|
184
|
+
// console.log(clonedNode);
|
|
185
|
+
|
|
186
|
+
expect(handles.more.text()).to.equal(`${moreLabel}`);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('long descriptions use Tooltip activated by hover', () => {
|
|
190
|
+
// this test causes the tooltip to 'flash' on the testing page http://localhost:8001/
|
|
191
|
+
handles.more.simulate('mouseenter');
|
|
192
|
+
// uses portal mount
|
|
193
|
+
should.exist(document.querySelector('.slds-popover_tooltip'));
|
|
194
|
+
handles.more.simulate('mouseleave');
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('search string highlights tooltip content', () => {
|
|
198
|
+
// this is a hack that waits for the tooltip to render through PopperJS
|
|
199
|
+
setTimeout(function timeoutFunction() {
|
|
200
|
+
expect(
|
|
201
|
+
handles.tile.find('.slds-popover__body mark').at(0).text()
|
|
202
|
+
).to.equal('enter');
|
|
203
|
+
}, 100);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
describe('App Launcher Tile (text icon)', () => {
|
|
208
|
+
beforeEach(() => {
|
|
209
|
+
mountTile({
|
|
210
|
+
description: 'Call center and contact center.',
|
|
211
|
+
iconBackgroundColor: 'rgb(115, 192, 123)',
|
|
212
|
+
iconText: 'CC',
|
|
213
|
+
title: 'Call Center',
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
afterEach(() => {
|
|
218
|
+
cleanDom();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('renders text icon with proper classes', () => {
|
|
222
|
+
const icon = handles.icon.find('span').at(0);
|
|
223
|
+
const iconAbbr = icon.find('abbr');
|
|
224
|
+
expect(icon).to.have.className('slds-avatar');
|
|
225
|
+
expect(icon).to.have.className('slds-avatar_large');
|
|
226
|
+
expect(iconAbbr).to.have.className('slds-avatar__initials');
|
|
227
|
+
expect(iconAbbr).to.have.className('slds-icon-custom-27');
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
it('tile can be passed a custom text icon', () => {
|
|
231
|
+
expect(handles.icon.find('abbr').text()).to.equal('CC');
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('tile can be passed a custom text icon background color', () => {
|
|
235
|
+
expect(handles.icon.find('abbr')).to.have.attr(
|
|
236
|
+
'style',
|
|
237
|
+
'background-color: rgb(115, 192, 123);'
|
|
238
|
+
);
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
describe('App Launcher Tile (icon node)', () => {
|
|
243
|
+
const iconNode = <Icon name="campaign" category="standard" size="large" />;
|
|
244
|
+
|
|
245
|
+
beforeEach(() => {
|
|
246
|
+
mountTile({
|
|
247
|
+
description: 'Call center and contact center.',
|
|
248
|
+
iconNode,
|
|
249
|
+
title: 'Call Center',
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
afterEach(() => {
|
|
254
|
+
cleanDom();
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('renders <Icon>', () => {
|
|
258
|
+
expect(handles.icon.find('span').at(0)).to.have.className(
|
|
259
|
+
'slds-icon_container'
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('renders <svg>', () => {
|
|
264
|
+
should.exist(handles.icon.find('svg'));
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
});
|