Commit 2e2bbfb7 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '201733-logs-search-is-broken' into 'master'

Allow submit to event to trigger a new search

Closes #201733

See merge request gitlab-org/gitlab!24262
parents 28cfd6d0 4949cd31
...@@ -204,7 +204,7 @@ export default { ...@@ -204,7 +204,7 @@ export default {
class="js-logs-search" class="js-logs-search"
type="search" type="search"
autofocus autofocus
@submit="disableAdvancedControls && setSearch(searchQuery)" @submit="!disableAdvancedControls && setSearch(searchQuery)"
/> />
</gl-form-group> </gl-form-group>
</div> </div>
......
---
title: Allow submit to event to trigger a new search
merge_request: 24262
author:
type: fixed
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
mockLogsResult, mockLogsResult,
mockTrace, mockTrace,
mockPodName, mockPodName,
mockSearch,
mockEnvironmentsEndpoint, mockEnvironmentsEndpoint,
mockDocumentationPath, mockDocumentationPath,
} from '../mock_data'; } from '../mock_data';
...@@ -33,6 +34,7 @@ describe('EnvironmentLogs', () => { ...@@ -33,6 +34,7 @@ describe('EnvironmentLogs', () => {
const actionMocks = { const actionMocks = {
setInitData: jest.fn(), setInitData: jest.fn(),
setSearch: jest.fn(),
showPodLogs: jest.fn(), showPodLogs: jest.fn(),
showEnvironment: jest.fn(), showEnvironment: jest.fn(),
fetchEnvironments: jest.fn(), fetchEnvironments: jest.fn(),
...@@ -205,10 +207,19 @@ describe('EnvironmentLogs', () => { ...@@ -205,10 +207,19 @@ describe('EnvironmentLogs', () => {
initWrapper(); initWrapper();
}); });
it('displays a disabled search bar and time window dropdown', () => { it('displays a disabled time window dropdown', () => {
expect(findTimeRangePicker().attributes('disabled')).toBe('true');
});
it('displays a disabled search bar', () => {
expect(findSearchBar().exists()).toBe(true); expect(findSearchBar().exists()).toBe(true);
expect(findSearchBar().attributes('disabled')).toBe('true'); expect(findSearchBar().attributes('disabled')).toBe('true');
expect(findTimeRangePicker().attributes('disabled')).toBe('true');
// input a query and click `search`
findSearchBar().vm.$emit('input', mockSearch);
findSearchBar().vm.$emit('submit');
expect(actionMocks.setSearch).not.toHaveBeenCalled();
}); });
}); });
...@@ -232,6 +243,13 @@ describe('EnvironmentLogs', () => { ...@@ -232,6 +243,13 @@ describe('EnvironmentLogs', () => {
it('displays an enabled search bar', () => { it('displays an enabled search bar', () => {
expect(findSearchBar().attributes('disabled')).toBeFalsy(); expect(findSearchBar().attributes('disabled')).toBeFalsy();
// input a query and click `search`
findSearchBar().vm.$emit('input', mockSearch);
findSearchBar().vm.$emit('submit');
expect(actionMocks.setSearch).toHaveBeenCalledTimes(1);
expect(actionMocks.setSearch).toHaveBeenCalledWith(mockSearch);
}); });
it('displays an enabled time window dropdown', () => { it('displays an enabled time window dropdown', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment