Loading...
-
+
-
+
-
-
+
-
@@ -537,6 +543,7 @@ limitations under the License.
file-list-increment="{{_numFilesShown}}">
{
+ element._loggedIn = true;
+ element._loading = false;
+ element._change = {
+ owner: {_account_id: 1},
+ labels: {},
+ actions: {
+ abandon: {
+ enabled: true,
+ label: 'Abandon',
+ method: 'POST',
+ title: 'Abandon',
+ },
+ },
+ };
+ sandbox.spy(element, '_handleHideBackgroundContent');
+ element.$.replyDialog.fire('fullscreen-overlay-opened');
+ assert.isTrue(element._handleHideBackgroundContent.called);
+ assert.isTrue(element.$.mainContent.classList.contains('overlayOpen'));
+ assert.equal(getComputedStyle(element.$.actions).display, 'block');
+ });
+
+ test('fullscreen-overlay-closed shows content', () => {
+ element._loggedIn = true;
+ element._loading = false;
+ element._change = {
+ owner: {_account_id: 1},
+ labels: {},
+ actions: {
+ abandon: {
+ enabled: true,
+ label: 'Abandon',
+ method: 'POST',
+ title: 'Abandon',
+ },
+ },
+ };
+ sandbox.spy(element, '_handleShowBackgroundContent');
+ element.$.replyDialog.fire('fullscreen-overlay-closed');
+ assert.isTrue(element._handleShowBackgroundContent.called);
+ assert.isFalse(element.$.mainContent.classList.contains('overlayOpen'));
+ });
+
test('X should expand all messages', () => {
const handleExpand =
sandbox.stub(element.$.messageList, 'handleExpandCollapse');
diff --git a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.html b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.html
index 419d2f7e4e..1b59d355da 100644
--- a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.html
+++ b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.html
@@ -25,6 +25,16 @@ limitations under the License.
background: #fff;
box-shadow: rgba(0, 0, 0, 0.3) 0 1px 3px;
}
+
+ @media screen and (max-width: 50em) {
+ :host {
+ height: 100%;
+ left: 0;
+ position: fixed;
+ right: 0;
+ top: 0;
+ }
+ }
diff --git a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.js b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.js
index 8db800464d..ebf2f027c1 100644
--- a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.js
+++ b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay.js
@@ -16,21 +16,61 @@
const AWAIT_MAX_ITERS = 10;
const AWAIT_STEP = 5;
+ const BREAKPOINT_FULLSCREEN_OVERLAY = '50em';
Polymer({
is: 'gr-overlay',
+ /**
+ * Fired when a fullscreen overlay is closed
+ *
+ * @event fullscreen-overlay-closed
+ */
+
+ /**
+ * Fired when an overlay is opened in full screen mode
+ *
+ * @event fullscreen-overlay-opened
+ */
+
+ properties: {
+ _fullScreenOpen: {
+ type: Boolean,
+ value: false,
+ },
+ },
+
behaviors: [
Polymer.IronOverlayBehavior,
],
+ listeners: {
+ 'iron-overlay-closed': '_close',
+ 'iron-overlay-cancelled': '_close',
+ },
+
open(...args) {
return new Promise(resolve => {
Polymer.IronOverlayBehaviorImpl.open.apply(this, args);
+ if (this._isMobile()) {
+ this.fire('fullscreen-overlay-opened');
+ this._fullScreenOpen = true;
+ }
this._awaitOpen(resolve);
});
},
+ _isMobile() {
+ return window.matchMedia(`(max-width: ${BREAKPOINT_FULLSCREEN_OVERLAY})`);
+ },
+
+ _close() {
+ if (this._fullScreenOpen) {
+ this.fire('fullscreen-overlay-closed');
+ this._fullScreenOpen = false;
+ }
+ },
+
/**
* Override the focus stops that iron-overlay-behavior tries to find.
*/
diff --git a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.html b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.html
new file mode 100644
index 0000000000..3f427ca211
--- /dev/null
+++ b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.html
@@ -0,0 +1,91 @@
+
+
+
+
+gr-overlay
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
content
+