зеркало из https://github.com/mozilla/treeherder.git
Bug 1553681 - Remove update confirmation dialog (#5618)
* removed update confirmation dialog * Added test for updateButtonClick prop
This commit is contained in:
Родитель
c725c8a41c
Коммит
464ffe8ffe
|
@ -1,7 +1,12 @@
|
|||
import React from 'react';
|
||||
import { fetchMock } from 'fetch-mock';
|
||||
import { Provider } from 'react-redux';
|
||||
import { render, cleanup, waitForElement } from '@testing-library/react';
|
||||
import {
|
||||
render,
|
||||
cleanup,
|
||||
waitForElement,
|
||||
fireEvent,
|
||||
} from '@testing-library/react';
|
||||
import thunk from 'redux-thunk';
|
||||
import configureMockStore from 'redux-mock-store';
|
||||
|
||||
|
@ -33,7 +38,7 @@ afterEach(() => {
|
|||
});
|
||||
|
||||
describe('SecondaryNavBar', () => {
|
||||
const testSecondaryNavBar = (store, filterModel) => (
|
||||
const testSecondaryNavBar = (store, filterModel, props) => (
|
||||
<Provider store={store}>
|
||||
<SecondaryNavBar
|
||||
updateButtonClick={() => {}}
|
||||
|
@ -44,6 +49,7 @@ describe('SecondaryNavBar', () => {
|
|||
duplicateJobsVisible={false}
|
||||
groupCountsExpanded={false}
|
||||
toggleFieldFilterVisible={() => {}}
|
||||
{...props}
|
||||
/>
|
||||
</Provider>
|
||||
);
|
||||
|
@ -76,4 +82,24 @@ describe('SecondaryNavBar', () => {
|
|||
expect(await waitForElement(() => getByText('22'))).toBeInTheDocument();
|
||||
expect(await waitForElement(() => getByText('10'))).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('should call updateButtonClick, on revision changed button click', async () => {
|
||||
const store = mockStore({
|
||||
pushes: {
|
||||
...initialState,
|
||||
},
|
||||
});
|
||||
|
||||
const props = {
|
||||
serverChanged: true,
|
||||
updateButtonClick: jest.fn(),
|
||||
};
|
||||
|
||||
const { container } = render(
|
||||
testSecondaryNavBar(store, new FilterModel(), props),
|
||||
);
|
||||
const el = container.querySelector('#revisionChangedLabel');
|
||||
fireEvent.click(el);
|
||||
expect(props.updateButtonClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -262,9 +262,7 @@ class App extends React.Component {
|
|||
}
|
||||
|
||||
updateButtonClick() {
|
||||
if (window.confirm('Reload the page to pick up Treeherder updates?')) {
|
||||
window.location.reload(true);
|
||||
}
|
||||
window.location.reload(true);
|
||||
}
|
||||
|
||||
handleSplitChange(latestSplitSize) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче