Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.

Commit 35e1839

Browse files
authored
Merge pull request #375 from ovh-ux/master
Sync master to develop
2 parents 411e594 + 29c2128 commit 35e1839

File tree

8 files changed

+49
-5
lines changed

8 files changed

+49
-5
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
<a name="2.26.0"></a>
2+
# [2.26.0](https://github.com/ovh-ux/ovh-ui-angular/compare/v2.25.1...v2.26.0) (2019-03-26)
3+
4+
5+
### Bug Fixes
6+
7+
* **oui-modal:** hide content when loading ([#373](https://github.com/ovh-ux/ovh-ui-angular/issues/373)) ([411e594](https://github.com/ovh-ux/ovh-ui-angular/commit/411e594))
8+
9+
10+
### Features
11+
12+
* **oui-collapsible:** add on-toggle event ([#372](https://github.com/ovh-ux/ovh-ui-angular/issues/372)) ([6b1adda](https://github.com/ovh-ux/ovh-ui-angular/commit/6b1adda))
13+
14+
15+
116
<a name="2.25.1"></a>
217
## [2.25.1](https://github.com/ovh-ux/ovh-ui-angular/compare/v2.25.0...v2.25.1) (2019-03-04)
318

dist/oui-angular.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/oui-angular.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "A set of maintainable components for the OVH ecosystem (Angular).",
44
"license": "BSD-3-Clause",
55
"author": "OVH SAS",
6-
"version": "2.25.1",
6+
"version": "2.26.0",
77
"keywords": [
88
"angular"
99
],

packages/oui-collapsible/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
</oui-collapsible>
2121
```
2222

23+
### Event handler
24+
25+
```html:preview
26+
<oui-collapsible heading="Title" aria-label="Action" expanded="true" on-toggle="$ctrl.onToggle(expanded)">
27+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis semper ligula nec fringilla tempor. In rhoncus ullamcorper feugiat. Phasellus vel ipsum vitae neque varius luctus. Proin id iaculis arcu. Fusce justo arcu, egestas vel nulla nec, dictum cursus lacus. Aenean elementum vel odio quis rutrum. In quis tellus in neque vulputate rhoncus vitae ut justo. Ut dignissim varius est in consequat. Donec nisi mauris, pellentesque condimentum congue in, blandit ut arcu. In et elit ipsum.
28+
</oui-collapsible>
29+
```
30+
2331
## API
2432

2533
### oui-collapsible
@@ -29,3 +37,4 @@
2937
| `heading` | string | @ | no | n/a | n/a | text of the heading
3038
| `aria-label` | string | @? | yes | n/a | n/a | accessibility label
3139
| `expanded` | boolean | <? | yes | n/a | `false` | initial expanded state
40+
| `on-toggle` | function | & | no | n/a | n/a | on collapsible state changed event handler

packages/oui-collapsible/src/collapsible.component.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export default {
88
id: "@",
99
heading: "@",
1010
ariaLabel: "@?",
11-
expanded: "<?"
11+
expanded: "<?",
12+
onToggle: "&"
1213
},
1314
transclude: true
1415
};

packages/oui-collapsible/src/collapsible.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ export default class {
3838

3939
toggle () {
4040
this.expanded = !this.expanded;
41+
this.onToggle({ expanded: this.expanded });
4142
}
4243
}

packages/oui-collapsible/src/index.spec.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,23 @@ describe("ouiCollapsible", () => {
7575
const contentEl = bodyEl.querySelector(".custom-content");
7676
expect(contentEl).toBeTruthy();
7777
});
78+
79+
it("should call ontoggle when defined into attributes", () => {
80+
const onToggle = jasmine.createSpy("onToggle");
81+
const element = TestUtils.compileTemplate(`
82+
<oui-collapsible heading="Title" aria-label="Action" on-toggle="$ctrl.onToggle(expanded)"></oui-collapsible>`, {
83+
onToggle
84+
});
85+
86+
const headerEl = angular.element(getHeaderElement(element));
87+
88+
// Expand
89+
headerEl.triggerHandler("click");
90+
expect(onToggle).toHaveBeenCalledWith(true);
91+
92+
// Collapse
93+
headerEl.triggerHandler("click");
94+
expect(onToggle).toHaveBeenCalledWith(false);
95+
});
7896
});
7997
});

0 commit comments

Comments
 (0)