Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

fix(fabToolbar): Fix md-direction attribute to be string instead of expression. #4185

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/fabToolbar/demoBasicUsage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
</p>
</md-content>

<md-fab-toolbar md-open="demo.isOpen" count="demo.count" md-direction="demo.selectedDirection">
<md-fab-toolbar md-open="demo.isOpen" count="demo.count"
md-direction="{{demo.selectedDirection}}">
<md-fab-trigger class="align-with-text">
<md-button aria-label="menu" class="md-fab md-primary">
<md-icon md-svg-src="img/icons/menu.svg"></md-icon>
Expand Down Expand Up @@ -55,4 +56,4 @@
</div>
</div>
</md-content>
</div>
</div>
2 changes: 1 addition & 1 deletion src/components/fabToolbar/fabToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
'</div>',

scope: {
direction: '=?mdDirection',
direction: '@?mdDirection',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need unit test for this.

isOpen: '=?mdOpen'
},

Expand Down
20 changes: 20 additions & 0 deletions src/components/fabToolbar/fabToolbar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ describe('<md-fab-toolbar> directive', function() {
});
}

it('applies a class for each direction', inject(function() {
build(
'<md-fab-toolbar md-direction="{{direction}}"></md-fab-toolbar>'
);

pageScope.$apply('direction = "left"');
expect(element.hasClass('md-left')).toBe(true);

pageScope.$apply('direction = "right"');
expect(element.hasClass('md-right')).toBe(true);
}));

it('accepts a string for md-direction', inject(function() {
build(
'<md-fab-toolbar md-direction="right"></md-fab-toolbar>'
);

expect(element.hasClass('md-right')).toBe(true);
}));

it('allows programmatic opening through the md-open attribute', inject(function() {
build(
'<md-fab-toolbar md-open="isOpen"></md-fab-toolbar>'
Expand Down