Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make paper-drawer-panel#rightDrawer default to true in RTL #130

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 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
8 changes: 7 additions & 1 deletion paper-drawer-panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,9 @@
*/
rightDrawer: {
type: Boolean,
value: false
value: function() {
return this._isRTL();
},
},

/**
Expand Down Expand Up @@ -550,6 +552,10 @@
this._transition = true;
},

_isRTL: function() {
return window.getComputedStyle(this).direction == 'rtl';
Copy link
Contributor

Choose a reason for hiding this comment

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

===

},

_onMainTransitionEnd: function (e) {
if (e.currentTarget === this.$.main && (e.propertyName === 'left' || e.propertyName === 'right')) {
this.notifyResize();
Expand Down
24 changes: 20 additions & 4 deletions test/positioning.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@

<test-fixture id="left-drawer">
<template>
<paper-drawer-panel>
<div drawer></div>
<div main></div>
</paper-drawer-panel>
<paper-drawer-panel>
<div drawer></div>
<div main></div>
</paper-drawer-panel>
</template>
</test-fixture>

Expand All @@ -44,6 +44,15 @@
</template>
</test-fixture>

<test-fixture id="rtl-drawer">
<template>
<paper-drawer-panel dir="rtl">
<div drawer></div>
<div main></div>
</paper-drawer-panel>
</template>
</test-fixture>

<script>
suite('positioning', function() {

Expand Down Expand Up @@ -87,6 +96,13 @@
});
});

test('rtl-drawer defaults rightDrawer to true', function(done) {
Polymer.Base.async(function() {
expect(fixture('rtl-drawer').rightDrawer).to.be.true;
done();
});
});

});
</script>
</body>
Expand Down