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 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
12 changes: 10 additions & 2 deletions paper-drawer-panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,7 @@
* If true, position the drawer to the right.
*/
rightDrawer: {
type: Boolean,
value: false
type: Boolean
},

/**
Expand Down Expand Up @@ -513,6 +512,11 @@
'_forceNarrowChanged(forceNarrow, defaultSelected)'
],

attached: function() {
if (this.rightDrawer === undefined)
this.rightDrawer = this._isRTL();
},

/**
* Toggles the panel open and closed.
*
Expand Down Expand Up @@ -550,6 +554,10 @@
this._transition = true;
},

_isRTL: function() {
return window.getComputedStyle(this).direction === 'rtl';
},

_onMainTransitionEnd: function (e) {
if (e.currentTarget === this.$.main && (e.propertyName === 'left' || e.propertyName === 'right')) {
this.notifyResize();
Expand Down
21 changes: 17 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,10 @@
});
});

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

});
</script>
</body>
Expand Down
21 changes: 9 additions & 12 deletions test/small-devices.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,25 @@
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../paper-drawer-panel.html">
</head>
<style>
<style is="custom-style">
body {
margin: 0;
padding: 0;
}
.notransition,
.notransition * {
-webkit-transition: none !important;
-moz-transition: none !important;
-o-transition: none !important;
-ms-transition: none !important;
transition: none !important;
.notransition {
--paper-drawer-panel-drawer-container: {
transition: none !important;
};
}
</style>
<body>

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

Expand Down