Commit 4e88386b authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Fix feature specs

parent eb0f66df
...@@ -11,9 +11,10 @@ export default () => { ...@@ -11,9 +11,10 @@ export default () => {
phrase, phrase,
buttonText, buttonText,
confirmDangerMessage, confirmDangerMessage,
testId = null, testid = null,
disabled = false, disabled = false,
} = el.dataset; } = el.dataset;
return new Vue({ return new Vue({
el, el,
provide: { provide: {
...@@ -24,7 +25,7 @@ export default () => { ...@@ -24,7 +25,7 @@ export default () => {
props: { props: {
phrase, phrase,
buttonText, buttonText,
testId, testid,
disabled: parseBoolean(disabled), disabled: parseBoolean(disabled),
}, },
on: { on: {
......
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
testId: { testid: {
type: String, type: String,
required: false, required: false,
default: 'confirm-danger-button', default: 'confirm-danger-button',
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
class="gl-button" class="gl-button"
variant="danger" variant="danger"
:disabled="disabled" :disabled="disabled"
:data-testid="testId" :data-testid="testid"
>{{ buttonText }}</gl-button >{{ buttonText }}</gl-button
> >
<confirm-danger-modal <confirm-danger-modal
......
...@@ -93,6 +93,7 @@ export default { ...@@ -93,6 +93,7 @@ export default {
</p> </p>
<gl-form-group :state="isValid" :invalid-feedback="$options.i18n.CONFIRM_DANGER_MODAL_ERROR"> <gl-form-group :state="isValid" :invalid-feedback="$options.i18n.CONFIRM_DANGER_MODAL_ERROR">
<gl-form-input <gl-form-input
id="confirm_name_input"
v-model="confirmationPhrase" v-model="confirmationPhrase"
class="form-control" class="form-control"
data-testid="confirm-danger-input" data-testid="confirm-danger-input"
......
- remove_form_id = local_assigns.fetch(:remove_form_id, nil) - remove_form_id = local_assigns.fetch(:remove_form_id, nil)
- confirm_modal_data = { "remove_form_id" => remove_form_id, "disabled" => group.paid?, "button-text" => _('Remove group'), "confirm-danger-message" => remove_group_message(group), phrase: group.full_path, 'testid' => 'remove-group-button' } - confirm_modal_data = { "remove_form_id" => remove_form_id, "disabled" => group.paid?.to_s, "button-text" => _('Remove group'), "confirm-danger-message" => remove_group_message(group), phrase: group.full_path, 'testid' => 'remove-group-button' }
- if group.paid? - if group.paid?
.gl-alert.gl-alert-info.gl-mb-5{ data: { testid: 'group-has-linked-subscription-alert' } } .gl-alert.gl-alert-info.gl-mb-5{ data: { testid: 'group-has-linked-subscription-alert' } }
......
...@@ -10,7 +10,7 @@ RSpec.describe 'groups/settings/_remove.html.haml' do ...@@ -10,7 +10,7 @@ RSpec.describe 'groups/settings/_remove.html.haml' do
render 'groups/settings/remove', group: group render 'groups/settings/remove', group: group
expect(rendered).to have_selector '[data-testid="remove-group-button"]' expect(rendered).to have_selector '[data-testid="remove-group-button"]'
expect(rendered).not_to have_selector '[data-testid="remove-group-button"].disabled' expect(rendered).not_to match 'data-disabled="true"'
expect(rendered).not_to have_selector '[data-testid="group-has-linked-subscription-alert"]' expect(rendered).not_to have_selector '[data-testid="group-has-linked-subscription-alert"]'
end end
...@@ -19,7 +19,8 @@ RSpec.describe 'groups/settings/_remove.html.haml' do ...@@ -19,7 +19,8 @@ RSpec.describe 'groups/settings/_remove.html.haml' do
render 'groups/settings/remove', group: group render 'groups/settings/remove', group: group
expect(rendered).to have_selector '[data-testid="remove-group-button"].disabled' expect(rendered).to have_selector '[data-testid="remove-group-button"]'
expect(rendered).to match 'data-disabled="true"'
expect(rendered).to have_selector '[data-testid="group-has-linked-subscription-alert"]' expect(rendered).to have_selector '[data-testid="group-has-linked-subscription-alert"]'
end end
...@@ -28,7 +29,8 @@ RSpec.describe 'groups/settings/_remove.html.haml' do ...@@ -28,7 +29,8 @@ RSpec.describe 'groups/settings/_remove.html.haml' do
render 'groups/settings/remove', group: group render 'groups/settings/remove', group: group
expect(rendered).to have_selector '[data-testid="remove-group-button"].disabled' expect(rendered).to have_selector '[data-testid="remove-group-button"]'
expect(rendered).to match 'data-disabled="true"'
expect(rendered).to have_selector '[data-testid="group-has-linked-subscription-alert"]' expect(rendered).to have_selector '[data-testid="group-has-linked-subscription-alert"]'
end end
...@@ -39,7 +41,7 @@ RSpec.describe 'groups/settings/_remove.html.haml' do ...@@ -39,7 +41,7 @@ RSpec.describe 'groups/settings/_remove.html.haml' do
render 'groups/settings/remove', group: subgroup render 'groups/settings/remove', group: subgroup
expect(rendered).to have_selector '[data-testid="remove-group-button"]' expect(rendered).to have_selector '[data-testid="remove-group-button"]'
expect(rendered).not_to have_selector '[data-testid="remove-group-button"].disabled' expect(rendered).not_to match 'data-disabled="true"'
expect(rendered).not_to have_selector '[data-testid="group-has-linked-subscription-alert"]' expect(rendered).not_to have_selector '[data-testid="group-has-linked-subscription-alert"]'
end end
...@@ -52,7 +54,7 @@ RSpec.describe 'groups/settings/_remove.html.haml' do ...@@ -52,7 +54,7 @@ RSpec.describe 'groups/settings/_remove.html.haml' do
render 'groups/settings/remove', group: group render 'groups/settings/remove', group: group
expect(rendered).to have_selector '[data-testid="remove-group-button"]' expect(rendered).to have_selector '[data-testid="remove-group-button"]'
expect(rendered).not_to have_selector '[data-testid="remove-group-button"].disabled' expect(rendered).not_to match 'data-disabled="true"'
expect(rendered).not_to have_selector '[data-testid="group-has-linked-subscription-alert"]' expect(rendered).not_to have_selector '[data-testid="group-has-linked-subscription-alert"]'
end end
...@@ -61,7 +63,8 @@ RSpec.describe 'groups/settings/_remove.html.haml' do ...@@ -61,7 +63,8 @@ RSpec.describe 'groups/settings/_remove.html.haml' do
render 'groups/settings/remove', group: group render 'groups/settings/remove', group: group
expect(rendered).to have_selector '[data-testid="remove-group-button"].disabled' expect(rendered).to have_selector '[data-testid="remove-group-button"]'
expect(rendered).to match 'data-disabled="true"'
expect(rendered).to have_selector '[data-testid="group-has-linked-subscription-alert"]' expect(rendered).to have_selector '[data-testid="group-has-linked-subscription-alert"]'
end end
...@@ -72,7 +75,7 @@ RSpec.describe 'groups/settings/_remove.html.haml' do ...@@ -72,7 +75,7 @@ RSpec.describe 'groups/settings/_remove.html.haml' do
render 'groups/settings/remove', group: subgroup render 'groups/settings/remove', group: subgroup
expect(rendered).to have_selector '[data-testid="remove-group-button"]' expect(rendered).to have_selector '[data-testid="remove-group-button"]'
expect(rendered).not_to have_selector '[data-testid="remove-group-button"].disabled' expect(rendered).not_to match 'data-disabled="true"'
expect(rendered).not_to have_selector '[data-testid="group-has-linked-subscription-alert"]' expect(rendered).not_to have_selector '[data-testid="group-has-linked-subscription-alert"]'
end end
end end
......
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