Skip to content

Commit

Permalink
Upgrade to EUI 1.1.0 (#20411)
Browse files Browse the repository at this point in the history
* Upgrade to EUI 1.0.1

* upgraded to eui 1.1.0

* fix setInspectorTablePageSize function in functional tests

* better comment about basic table pagination buttons
  • Loading branch information
nreese authored Jul 6, 2018
1 parent 8b8e5a0 commit 61d7b91
Show file tree
Hide file tree
Showing 8 changed files with 217 additions and 189 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"url": "https:/elastic/kibana.git"
},
"dependencies": {
"@elastic/eui": "0.0.55",
"@elastic/eui": "1.1.0",
"@elastic/filesaver": "1.1.2",
"@elastic/numeral": "2.3.2",
"@elastic/ui-ace": "0.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,117 +95,132 @@ test('renders ControlsTab', () => {
expect(component).toMatchSnapshot(); // eslint-disable-line
});

test('add control btn', () => {
const component = mount(<ControlsTab
scope={scopeMock}
editorState={scopeMock.editorState}
stageEditorParams={stageEditorParams}
/>);
findTestSubject(component, 'inputControlEditorAddBtn').simulate('click');
// Use custom match function since control.id is dynamically generated and never the same.
sinon.assert.calledWith(stageEditorParams, sinon.match((newParams) => {
if (newParams.controls.length !== 3) {
return false;
}
return true;
}, 'control not added to editorState.params'));
});
describe('behavior', () => {
// Mock MutationObserver used in EuiAccordion
beforeAll(() => {
global.MutationObserver = class {
constructor() {}
disconnect() {}
observe() {}
};
});

test('remove control btn', () => {
const component = mount(<ControlsTab
scope={scopeMock}
editorState={scopeMock.editorState}
stageEditorParams={stageEditorParams}
/>);
findTestSubject(component, 'inputControlEditorRemoveControl0').simulate('click');
const expectedParams = {
'controls': [
{
'id': '2',
'indexPattern': 'indexPattern1',
'fieldName': 'numberField',
'label': '',
'type': 'range',
'options': {
'step': 1
}
}
]
};
sinon.assert.calledWith(stageEditorParams, sinon.match(expectedParams));
});
afterAll(() => {
delete global.MutationObserver;
});

test('add control button', () => {
const component = mount(<ControlsTab
scope={scopeMock}
editorState={scopeMock.editorState}
stageEditorParams={stageEditorParams}
/>);
findTestSubject(component, 'inputControlEditorAddBtn').simulate('click');
// Use custom match function since control.id is dynamically generated and never the same.
sinon.assert.calledWith(stageEditorParams, sinon.match((newParams) => {
if (newParams.controls.length !== 3) {
return false;
}
return true;
}, 'control not added to editorState.params'));
});

test('move down control btn', () => {
const component = mount(<ControlsTab
scope={scopeMock}
editorState={scopeMock.editorState}
stageEditorParams={stageEditorParams}
/>);
findTestSubject(component, 'inputControlEditorMoveDownControl0').simulate('click');
const expectedParams = {
'controls': [
{
'id': '2',
'indexPattern': 'indexPattern1',
'fieldName': 'numberField',
'label': '',
'type': 'range',
'options': {
'step': 1
}
},
{
'id': '1',
'indexPattern': 'indexPattern1',
'fieldName': 'keywordField',
'label': 'custom label',
'type': 'list',
'options': {
'type': 'terms',
'multiselect': true,
'size': 5,
'order': 'desc'
test('remove control button', () => {
const component = mount(<ControlsTab
scope={scopeMock}
editorState={scopeMock.editorState}
stageEditorParams={stageEditorParams}
/>);
findTestSubject(component, 'inputControlEditorRemoveControl0').simulate('click');
const expectedParams = {
'controls': [
{
'id': '2',
'indexPattern': 'indexPattern1',
'fieldName': 'numberField',
'label': '',
'type': 'range',
'options': {
'step': 1
}
}
}
]
};
sinon.assert.calledWith(stageEditorParams, sinon.match(expectedParams));
});
]
};
sinon.assert.calledWith(stageEditorParams, sinon.match(expectedParams));
});

test('move up control btn', () => {
const component = mount(<ControlsTab
scope={scopeMock}
editorState={scopeMock.editorState}
stageEditorParams={stageEditorParams}
/>);
findTestSubject(component, 'inputControlEditorMoveUpControl1').simulate('click');
const expectedParams = {
'controls': [
{
'id': '2',
'indexPattern': 'indexPattern1',
'fieldName': 'numberField',
'label': '',
'type': 'range',
'options': {
'step': 1

test('move down control button', () => {
const component = mount(<ControlsTab
scope={scopeMock}
editorState={scopeMock.editorState}
stageEditorParams={stageEditorParams}
/>);
findTestSubject(component, 'inputControlEditorMoveDownControl0').simulate('click');
const expectedParams = {
'controls': [
{
'id': '2',
'indexPattern': 'indexPattern1',
'fieldName': 'numberField',
'label': '',
'type': 'range',
'options': {
'step': 1
}
},
{
'id': '1',
'indexPattern': 'indexPattern1',
'fieldName': 'keywordField',
'label': 'custom label',
'type': 'list',
'options': {
'type': 'terms',
'multiselect': true,
'size': 5,
'order': 'desc'
}
}
},
{
'id': '1',
'indexPattern': 'indexPattern1',
'fieldName': 'keywordField',
'label': 'custom label',
'type': 'list',
'options': {
'type': 'terms',
'multiselect': true,
'size': 5,
'order': 'desc'
]
};
sinon.assert.calledWith(stageEditorParams, sinon.match(expectedParams));
});

test('move up control button', () => {
const component = mount(<ControlsTab
scope={scopeMock}
editorState={scopeMock.editorState}
stageEditorParams={stageEditorParams}
/>);
findTestSubject(component, 'inputControlEditorMoveUpControl1').simulate('click');
const expectedParams = {
'controls': [
{
'id': '2',
'indexPattern': 'indexPattern1',
'fieldName': 'numberField',
'label': '',
'type': 'range',
'options': {
'step': 1
}
},
{
'id': '1',
'indexPattern': 'indexPattern1',
'fieldName': 'keywordField',
'label': 'custom label',
'type': 'list',
'options': {
'type': 'terms',
'multiselect': true,
'size': 5,
'order': 'desc'
}
}
}
]
};
sinon.assert.calledWith(stageEditorParams, sinon.match(expectedParams));
]
};
sinon.assert.calledWith(stageEditorParams, sinon.match(expectedParams));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,40 @@ exports[`DashboardPanel matches snapshot 1`] = `
class="kuiMicroButtonGroup"
>
<div
class="euiPopover euiPopover--anchorDownRight dashboardPanelPopOver euiPopover--withTitle"
class="euiPopover euiPopover--anchorDownRight euiPopover--withTitle dashboardPanelPopOver"
id="dashboardPanelContextMenu"
>
<button
aria-label="Panel options"
class="euiButtonIcon euiButtonIcon--text"
data-test-subj="dashboardPanelToggleMenuIcon"
type="button"
<div
class="euiPopover__anchor"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiButtonIcon__icon"
focusable="false"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
<button
aria-label="Panel options"
class="euiButtonIcon euiButtonIcon--text"
data-test-subj="dashboardPanelToggleMenuIcon"
type="button"
>
<defs>
<path
d="M.164 10.329L1.87 8 .163 5.67c.18-.601.43-1.19.758-1.757a8.197 8.197 0 0 1 1.142-1.535l2.872.313L6.099.05a8.166 8.166 0 0 1 3.8-.003l1.166 2.644 2.872-.313a8.166 8.166 0 0 1 1.899 3.293L14.13 8l1.706 2.33c-.18.601-.43 1.19-.758 1.757a8.197 8.197 0 0 1-1.142 1.535l-2.872-.313-1.164 2.641a8.166 8.166 0 0 1-3.8.003l-1.166-2.644-2.872.313a8.166 8.166 0 0 1-1.899-3.293zm4.663 1.986a1 1 0 0 1 1.023.591l.957 2.17c.79.134 1.597.132 2.387-.001l.956-2.169a1 1 0 0 1 1.023-.59l2.358.256a7.23 7.23 0 0 0 1.194-2.068l-1.401-1.913a1 1 0 0 1 0-1.182l1.4-1.912a7.165 7.165 0 0 0-1.192-2.069l-2.359.257a1 1 0 0 1-1.023-.591L9.193.924a7.165 7.165 0 0 0-2.387.001L5.85 3.094a1 1 0 0 1-1.023.59l-2.358-.256a7.23 7.23 0 0 0-1.194 2.068l1.401 1.913a1 1 0 0 1 0 1.182l-1.4 1.912c.28.751.681 1.45 1.192 2.069l2.359-.257zM8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"
id="gear-a"
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiButtonIcon__icon"
focusable="false"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<defs>
<path
d="M.164 10.329L1.87 8 .163 5.67c.18-.601.43-1.19.758-1.757a8.197 8.197 0 0 1 1.142-1.535l2.872.313L6.099.05a8.166 8.166 0 0 1 3.8-.003l1.166 2.644 2.872-.313a8.166 8.166 0 0 1 1.899 3.293L14.13 8l1.706 2.33c-.18.601-.43 1.19-.758 1.757a8.197 8.197 0 0 1-1.142 1.535l-2.872-.313-1.164 2.641a8.166 8.166 0 0 1-3.8.003l-1.166-2.644-2.872.313a8.166 8.166 0 0 1-1.899-3.293zm4.663 1.986a1 1 0 0 1 1.023.591l.957 2.17c.79.134 1.597.132 2.387-.001l.956-2.169a1 1 0 0 1 1.023-.59l2.358.256a7.23 7.23 0 0 0 1.194-2.068l-1.401-1.913a1 1 0 0 1 0-1.182l1.4-1.912a7.165 7.165 0 0 0-1.192-2.069l-2.359.257a1 1 0 0 1-1.023-.591L9.193.924a7.165 7.165 0 0 0-2.387.001L5.85 3.094a1 1 0 0 1-1.023.59l-2.358-.256a7.23 7.23 0 0 0-1.194 2.068l1.401 1.913a1 1 0 0 1 0 1.182l-1.4 1.912c.28.751.681 1.45 1.192 2.069l2.359-.257zM8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"
id="gear-a"
/>
</defs>
<use
xlink:href="#gear-a"
/>
</defs>
<use
xlink:href="#gear-a"
/>
</svg>
</button>
</svg>
</button>
</div>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 61d7b91

Please sign in to comment.