Skip to content

Commit

Permalink
feat(form-actions): switch buttons positions (#835)
Browse files Browse the repository at this point in the history
ref: MANAGER-12813

Signed-off-by: Quentin Pavy <[email protected]>
  • Loading branch information
qpavy authored Dec 14, 2023
1 parent 980a4a9 commit 61ed9fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions packages/components/form-actions/src/js/form-actions.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<div class="oui-button-group">
<button class="oui-button oui-button_l oui-button_primary"
type="submit"
ng-bind="::$ctrl.submitText"
ng-click="$ctrl.onSubmit()"
ng-disabled="$ctrl.disabled">
</button>
<button class="oui-button oui-button_l oui-button_secondary"
type="button"
ng-if="::!$ctrl.href && !!$ctrl.onCancel"
Expand All @@ -17,4 +11,10 @@
ng-click="$ctrl.onCancel()"
ng-href="{{:: $ctrl.href }}">
</a>
<button class="oui-button oui-button_l oui-button_primary"
type="submit"
ng-bind="::$ctrl.submitText"
ng-click="$ctrl.onSubmit()"
ng-disabled="$ctrl.disabled">
</button>
</div>
20 changes: 10 additions & 10 deletions packages/components/form-actions/src/js/form-actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ describe('ouiFormActions', () => {
on-submit="$ctrl.submit()"
on-cancel="$ctrl.cancel()">
</oui-form-actions>`);
const submitButton = component.find('button').eq(0);
const cancelButton = component.find('button').eq(1);
const cancelButton = component.find('button').eq(0);
const submitButton = component.find('button').eq(1);

expect(submitButton.hasClass('oui-button_primary')).toBe(true);
expect(cancelButton.hasClass('oui-button_secondary')).toBe(true);
Expand All @@ -53,8 +53,8 @@ describe('ouiFormActions', () => {
on-submit="$ctrl.submit()"
on-cancel="$ctrl.cancel()">
</oui-form-actions>`);
const submitButton = component.find('button').eq(0);
const cancelButton = component.find('button').eq(1);
const cancelButton = component.find('button').eq(0);
const submitButton = component.find('button').eq(1);

expect(submitButton.text().trim()).toBe(SUBMIT_TEXT);
expect(cancelButton.text().trim()).toBe(CANCEL_TEXT);
Expand All @@ -68,8 +68,8 @@ describe('ouiFormActions', () => {
submit-text="testSubmit"
cancel-text="testCancel">
</oui-form-actions>`);
const submitButton = component.find('button').eq(0);
const cancelButton = component.find('button').eq(1);
const cancelButton = component.find('button').eq(0);
const submitButton = component.find('button').eq(1);

expect(submitButton.text().trim()).toBe('testSubmit');
expect(cancelButton.text().trim()).toBe('testCancel');
Expand All @@ -82,7 +82,7 @@ describe('ouiFormActions', () => {
on-cancel="$ctrl.cancel()"
disabled>
</oui-form-actions>`);
const submitButton = component.find('button').eq(0);
const submitButton = component.find('button').eq(1);

expect(submitButton.attr('disabled')).toBe('disabled');
});
Expand All @@ -93,7 +93,7 @@ describe('ouiFormActions', () => {
on-submit="$ctrl.submit()"
on-cancel="$ctrl.cancel()">
</oui-form-actions>`);
const cancelButton = component.find('button').eq(1);
const cancelButton = component.find('button').eq(0);

expect(cancelButton.hasClass('ng-hide')).toBe(false);
});
Expand All @@ -115,7 +115,7 @@ describe('ouiFormActions', () => {
</oui-form-actions>`, {
onSubmitTest: jasmine.createSpy('onSubmit'),
});
component.find('button').eq(0).triggerHandler('click');
component.find('button').eq(1).triggerHandler('click');

expect(component.scope().$ctrl.onSubmitTest).toHaveBeenCalled();
});
Expand All @@ -128,7 +128,7 @@ describe('ouiFormActions', () => {
</oui-form-actions>`, {
onCancelTest: jasmine.createSpy('onCancel'),
});
component.find('button').eq(1).triggerHandler('click');
component.find('button').eq(0).triggerHandler('click');

expect(component.scope().$ctrl.onCancelTest).toHaveBeenCalled();
});
Expand Down

0 comments on commit 61ed9fd

Please sign in to comment.