mirror of
https://github.com/ansible/awx.git
synced 2026-01-22 15:08:03 -03:30
Adds SurveyList tool bar
This commit is contained in:
parent
0fd9153cf7
commit
64b1aa43b1
@ -36,7 +36,7 @@ function SurveyList({ template, i18n }) {
|
||||
data: { spec = [], description: surveyDescription, name: surveyName },
|
||||
} = await JobTemplatesAPI.readSurvey(template.id);
|
||||
return {
|
||||
questions: spec.map((s, index) => ({ ...s, id: index })),
|
||||
questions: spec?.map((s, index) => ({ ...s, id: index })),
|
||||
description: surveyDescription,
|
||||
name: surveyName,
|
||||
};
|
||||
|
||||
@ -36,6 +36,7 @@ describe('<SurveyList />', () => {
|
||||
expect(JobTemplatesAPI.readSurvey).toBeCalledWith(7);
|
||||
|
||||
wrapper.update();
|
||||
|
||||
expect(wrapper.find('SurveyListItem').length).toBe(1);
|
||||
});
|
||||
test('error in retrieving the survey throws an error', async () => {
|
||||
@ -55,7 +56,11 @@ describe('<SurveyList />', () => {
|
||||
JobTemplatesAPI.update.mockResolvedValue();
|
||||
let wrapper;
|
||||
await act(async () => {
|
||||
<<<<<<< HEAD
|
||||
wrapper = mountWithContexts(
|
||||
=======
|
||||
wrapper = await mountWithContexts(
|
||||
>>>>>>> Adds SurveyList tool bar
|
||||
<SurveyList
|
||||
template={{ ...mockJobTemplateData, survey_enabled: false }}
|
||||
/>
|
||||
@ -65,7 +70,11 @@ describe('<SurveyList />', () => {
|
||||
expect(wrapper.find('Switch').length).toBe(1);
|
||||
expect(wrapper.find('Switch').prop('isChecked')).toBe(false);
|
||||
await act(async () => {
|
||||
<<<<<<< HEAD
|
||||
wrapper.find('Switch').invoke('onChange')(true);
|
||||
=======
|
||||
await wrapper.find('Switch').invoke('onChange')(true);
|
||||
>>>>>>> Adds SurveyList tool bar
|
||||
});
|
||||
|
||||
wrapper.update();
|
||||
@ -79,7 +88,11 @@ describe('<SurveyList />', () => {
|
||||
test('selectAll enables delete button and calls the api to delete properly', async () => {
|
||||
let wrapper;
|
||||
await act(async () => {
|
||||
<<<<<<< HEAD
|
||||
wrapper = mountWithContexts(
|
||||
=======
|
||||
wrapper = await mountWithContexts(
|
||||
>>>>>>> Adds SurveyList tool bar
|
||||
<SurveyList
|
||||
template={{ ...mockJobTemplateData, survey_enabled: false }}
|
||||
/>
|
||||
@ -126,7 +139,11 @@ describe('Survey with no questions', () => {
|
||||
JobTemplatesAPI.readSurvey.mockResolvedValue({});
|
||||
let wrapper;
|
||||
await act(async () => {
|
||||
<<<<<<< HEAD
|
||||
wrapper = mountWithContexts(
|
||||
=======
|
||||
wrapper = await mountWithContexts(
|
||||
>>>>>>> Adds SurveyList tool bar
|
||||
<SurveyList template={mockJobTemplateData} />
|
||||
);
|
||||
});
|
||||
|
||||
@ -75,7 +75,9 @@ export function useDeleteItems(
|
||||
if (params.page > 1 && allItemsSelected) {
|
||||
const newParams = encodeNonDefaultQueryString(
|
||||
qsConfig,
|
||||
replaceParams(params, { page: params.page - 1 })
|
||||
replaceParams(params, {
|
||||
page: params.page - 1,
|
||||
})
|
||||
);
|
||||
history.push(`${location.pathname}?${newParams}`);
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user