diff --git a/packages/oui-modal/README.md b/packages/oui-modal/README.md index 6cc3d121..ab008655 100644 --- a/packages/oui-modal/README.md +++ b/packages/oui-modal/README.md @@ -44,11 +44,10 @@
@@ -61,17 +60,29 @@ ### Warning modal ```html:preview -
Modal content -
+``` + +### Disabled buttons + +```html:preview + + You shall not pass! + ``` ## API @@ -83,8 +94,10 @@ | `loading` | boolean | { expect($secondaryButton.attr("disabled")).toBe("disabled"); }); + it("should disable buttons when the conditions are met", () => { + const primaryDisabled = true; + const secondaryDisabled = true; + + const element = TestUtils.compileTemplate(` + + + `, { + primaryLabel, + secondaryLabel, + primaryDisabled, + secondaryDisabled + }); + + const $footer = getFooter(element); + const $primaryButton = getPrimaryButton($footer); + const $secondaryButton = getSecondaryButton($footer); + + expect($primaryButton).toBeDefined(); + expect($primaryButton.attr("disabled")).toBe("disabled"); + expect($secondaryButton).toBeDefined(); + expect($secondaryButton.attr("disabled")).toBe("disabled"); + }); + it("should trigger secondary action", () => { const secondarySpy = jasmine.createSpy("secondaryClick"); const element = TestUtils.compileTemplate(` diff --git a/packages/oui-modal/src/modal.component.js b/packages/oui-modal/src/modal.component.js index 5a656647..2576c362 100644 --- a/packages/oui-modal/src/modal.component.js +++ b/packages/oui-modal/src/modal.component.js @@ -11,8 +11,10 @@ export default { loading: " + ng-disabled="$ctrl.loading || $ctrl.secondaryDisabled">