Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Vis: Default editor] EUIficate string control #32881

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import _ from 'lodash';
import $ from 'jquery';
import ngMock from 'ng_mock';
import expect from 'expect.js';
import sinon from 'sinon';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { VisProvider } from '../../../../vis';
import { intervalOptions } from '../../../buckets/_interval_options';
Expand Down Expand Up @@ -58,6 +59,10 @@ describe('editor', function () {
]
});

const formCtrl = {
$addControl: sinon.fake()
};

const $el = $('<vis-editor-agg-params agg="agg" ' +
'index-pattern="agg.getIndexPattern()" ' +
'group-name="groupName">' +
Expand All @@ -68,6 +73,7 @@ describe('editor', function () {
$parentScope.groupName = 'buckets';
$parentScope.vis = vis;

$el.data('$formController', formCtrl);
$compile($el)($parentScope);
$scope = $el.scope();
$scope.$digest();
Expand Down
6 changes: 5 additions & 1 deletion src/legacy/ui/public/agg_types/controls/string.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ function StringSelect({ agg = {}, aggParam = {}, onParamsChange }: StringSelectP

return (
<EuiFormRow label={aggParam.displayName || aggParam.name} className="form-group">
<EuiFieldText id={`visEditorStringInput${agg.id}${aggParam.name}`} onChange={onChange} />
<EuiFieldText
id={`visEditorStringInput${agg.id}${aggParam.name}`}
name={`visEditorStringInput${agg.id}${aggParam.name}`}
maryia-lapata marked this conversation as resolved.
Show resolved Hide resolved
onChange={onChange}
/>
</EuiFormRow>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import angular from 'angular';
import _ from 'lodash';
import expect from 'expect.js';
import sinon from 'sinon';
import ngMock from 'ng_mock';
import '../agg_params';
import { VisProvider } from '../../..';
Expand Down Expand Up @@ -61,6 +62,10 @@ describe('Vis-Editor-Agg-Params plugin directive', function () {
orderAggSchema = (new Schemas([config])).all[0];
$parentScope.groupName = 'metrics';

const formCtrl = {
$addControl: sinon.fake()
};

const state = {
schema: orderAggSchema,
type: 'count'
Expand All @@ -84,6 +89,8 @@ describe('Vis-Editor-Agg-Params plugin directive', function () {
`<vis-editor-agg-params index-pattern="vis.indexPattern" agg="agg" group-name="groupName"></vis-editor-agg-params>`
);

$elem.data('$formController', formCtrl);

// compile the html
compile($elem)($parentScope);

Expand Down
2 changes: 1 addition & 1 deletion test/functional/page_objects/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
}

async setCustomLabel(label, index = 1) {
const customLabel = await find.byCssSelector(`#visEditorStringInput${index}customLabel`);
const customLabel = await find.byCssSelector(`[name="visEditorStringInput${index}customLabel"]`);
maryia-lapata marked this conversation as resolved.
Show resolved Hide resolved
customLabel.type(label);
}

Expand Down