From bc9bd5217374abf83e3e69d790d1a546d6df5565 Mon Sep 17 00:00:00 2001 From: varun257 Date: Fri, 1 Mar 2019 14:07:57 +0530 Subject: [PATCH] feat(oui-slideshow): add on click event for navigation add on-click event for slideshow navigation add test case and example resolves MBE-283 --- packages/oui-slideshow/README.md | 36 +++++++++++++++---- packages/oui-slideshow/src/index.spec.js | 16 +++++++++ .../oui-slideshow/src/slideshow.component.js | 2 +- .../oui-slideshow/src/slideshow.controller.js | 2 ++ 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/packages/oui-slideshow/README.md b/packages/oui-slideshow/README.md index 9a0a5c17..9dbd843c 100644 --- a/packages/oui-slideshow/README.md +++ b/packages/oui-slideshow/README.md @@ -78,16 +78,40 @@ ``` +### Panel change event +**Note**: If you want to access the parameters inside `on-panel-change` callback, you need to use `direction` and `index` variables as below. + +* `direction` returns string of `prev` or `next` +* `index` returns index of current slide + +```html:preview +
+ + + Display your infrastructure as a list + + + Designed to help you synchronize your local Active Directory with your OVH Active Directory. + + +
+``` + ## API ### oui-slideshow -| Attribute | Type | Binding | One-time Binding | Values | Default | Description -| ---- | ---- | ---- | ---- | ---- | ---- | ---- -| `theme` | string | @? | yes | n/a | `default` | add specific theme to component -| `loading` | boolean | { $timeout.flush(); expect($firstPanel.hasClass("active")).toBe(false); }); + + it("should call function of event with attributes", () => { + const onPanelChangeSpy = jasmine.createSpy("onPanelChangeSpy"); + const element = TestUtils.compileTemplate(` + + + + `, { + onPanelChangeSpy + }); + const direction = "next"; + const index = 1; + $timeout.flush(); + getNextButton(element).triggerHandler("click"); + expect(onPanelChangeSpy).toHaveBeenCalledWith(direction, index); + }); }); }); }); diff --git a/packages/oui-slideshow/src/slideshow.component.js b/packages/oui-slideshow/src/slideshow.component.js index 401d3367..53303aed 100644 --- a/packages/oui-slideshow/src/slideshow.component.js +++ b/packages/oui-slideshow/src/slideshow.component.js @@ -9,6 +9,6 @@ export default { onDismiss: "&", loading: "