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

Commit

Permalink
fix(fabToolbar): Fix md-direction attribute to be a string instead of…
Browse files Browse the repository at this point in the history
… expression.

Fix `md-direction` attribute to use the correct scope initialization.

Fixes #3390. Closes #4185.
  • Loading branch information
topherfangio authored and ThomasBurleson committed Aug 19, 2015
1 parent 7fd8b09 commit ec336c7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
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',
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

0 comments on commit ec336c7

Please sign in to comment.