зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 0845f945173f (bug 1266414) for still failing browser_device_modal_exit.js. r=backout
This commit is contained in:
Родитель
cf7763f374
Коммит
66bdd9abc3
|
@ -2,8 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/* eslint-env browser */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { DOM: dom, createClass, PropTypes, addons } =
|
const { DOM: dom, createClass, PropTypes, addons } =
|
||||||
|
@ -27,10 +25,6 @@ module.exports = createClass({
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
window.addEventListener("keydown", this.onKeyDown, true);
|
|
||||||
},
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
let {
|
let {
|
||||||
devices,
|
devices,
|
||||||
|
@ -45,10 +39,6 @@ module.exports = createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
window.removeEventListener("keydown", this.onKeyDown, true);
|
|
||||||
},
|
|
||||||
|
|
||||||
onDeviceCheckboxClick({ target }) {
|
onDeviceCheckboxClick({ target }) {
|
||||||
this.setState({
|
this.setState({
|
||||||
[target.value]: !this.state[target.value]
|
[target.value]: !this.state[target.value]
|
||||||
|
@ -88,25 +78,18 @@ module.exports = createClass({
|
||||||
onUpdateDeviceModalOpen(false);
|
onUpdateDeviceModalOpen(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeyDown(event) {
|
|
||||||
if (!this.props.devices.isModalOpen) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Escape keycode
|
|
||||||
if (event.keyCode === 27) {
|
|
||||||
let {
|
|
||||||
onUpdateDeviceModalOpen
|
|
||||||
} = this.props;
|
|
||||||
onUpdateDeviceModalOpen(false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let {
|
let {
|
||||||
devices,
|
devices,
|
||||||
onUpdateDeviceModalOpen,
|
onUpdateDeviceModalOpen,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
let modalClass = "device-modal container";
|
||||||
|
|
||||||
|
if (!devices.isModalOpen) {
|
||||||
|
modalClass += " hidden";
|
||||||
|
}
|
||||||
|
|
||||||
const sortedDevices = {};
|
const sortedDevices = {};
|
||||||
for (let type of devices.types) {
|
for (let type of devices.types) {
|
||||||
sortedDevices[type] = Object.assign([], devices[type])
|
sortedDevices[type] = Object.assign([], devices[type])
|
||||||
|
@ -115,66 +98,54 @@ module.exports = createClass({
|
||||||
|
|
||||||
return dom.div(
|
return dom.div(
|
||||||
{
|
{
|
||||||
id: "device-modal-wrapper",
|
className: modalClass,
|
||||||
className: this.props.devices.isModalOpen ? "opened" : "closed",
|
|
||||||
},
|
},
|
||||||
|
dom.button({
|
||||||
|
id: "device-close-button",
|
||||||
|
className: "toolbar-button devtools-button",
|
||||||
|
onClick: () => onUpdateDeviceModalOpen(false),
|
||||||
|
}),
|
||||||
dom.div(
|
dom.div(
|
||||||
{
|
{
|
||||||
className: "device-modal container",
|
className: "device-modal-content",
|
||||||
},
|
},
|
||||||
dom.button({
|
devices.types.map(type => {
|
||||||
id: "device-close-button",
|
return dom.div(
|
||||||
className: "toolbar-button devtools-button",
|
{
|
||||||
onClick: () => onUpdateDeviceModalOpen(false),
|
className: "device-type",
|
||||||
}),
|
key: type,
|
||||||
dom.div(
|
},
|
||||||
{
|
dom.header(
|
||||||
className: "device-modal-content",
|
|
||||||
},
|
|
||||||
devices.types.map(type => {
|
|
||||||
return dom.div(
|
|
||||||
{
|
{
|
||||||
className: "device-type",
|
className: "device-header",
|
||||||
key: type,
|
|
||||||
},
|
},
|
||||||
dom.header(
|
type
|
||||||
|
),
|
||||||
|
sortedDevices[type].map(device => {
|
||||||
|
return dom.label(
|
||||||
{
|
{
|
||||||
className: "device-header",
|
className: "device-label",
|
||||||
|
key: device.name,
|
||||||
},
|
},
|
||||||
type
|
dom.input({
|
||||||
),
|
className: "device-input-checkbox",
|
||||||
sortedDevices[type].map(device => {
|
type: "checkbox",
|
||||||
return dom.label(
|
value: device.name,
|
||||||
{
|
checked: this.state[device.name],
|
||||||
className: "device-label",
|
onChange: this.onDeviceCheckboxClick,
|
||||||
key: device.name,
|
}),
|
||||||
},
|
device.name
|
||||||
dom.input({
|
);
|
||||||
className: "device-input-checkbox",
|
})
|
||||||
type: "checkbox",
|
);
|
||||||
value: device.name,
|
})
|
||||||
checked: this.state[device.name],
|
|
||||||
onChange: this.onDeviceCheckboxClick,
|
|
||||||
}),
|
|
||||||
device.name
|
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
})
|
|
||||||
),
|
|
||||||
dom.button(
|
|
||||||
{
|
|
||||||
id: "device-submit-button",
|
|
||||||
onClick: this.onDeviceModalSubmit,
|
|
||||||
},
|
|
||||||
getStr("responsive.done")
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
dom.div(
|
dom.button(
|
||||||
{
|
{
|
||||||
className: "modal-overlay",
|
id: "device-submit-button",
|
||||||
onClick: () => onUpdateDeviceModalOpen(false),
|
onClick: this.onDeviceModalSubmit,
|
||||||
}
|
},
|
||||||
|
getStr("responsive.done")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#root,
|
#root,
|
||||||
html, body {
|
html, body {
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,10 +47,12 @@ html, body {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding-top: 15px;
|
height: 100vh;
|
||||||
padding-bottom: 1%;
|
|
||||||
position: relative;
|
/* Snap to the top of the app when there isn't enough vertical space anymore
|
||||||
height: 100%;
|
to center the viewports (so we don't lose the global toolbar) */
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +86,7 @@ html, body {
|
||||||
color: var(--theme-body-color-alt);
|
color: var(--theme-body-color-alt);
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
box-shadow: var(--rdm-box-shadow);
|
box-shadow: var(--rdm-box-shadow);
|
||||||
margin: 0 0 15px 0;
|
margin: 10% 0 30px 0;
|
||||||
padding: 4px 5px;
|
padding: 4px 5px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
|
@ -335,33 +336,9 @@ html, body {
|
||||||
* Device Modal
|
* Device Modal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@keyframes fade-in-and-up {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(5px);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fade-down-and-out {
|
|
||||||
0% {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0px);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(5px);
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.device-modal {
|
.device-modal {
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
box-shadow: var(--rdm-box-shadow);
|
box-shadow: var(--rdm-box-shadow);
|
||||||
display: none;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -370,31 +347,10 @@ html, body {
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 642px;
|
width: 642px;
|
||||||
height: 612px;
|
height: 612px;
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handles the opening/closing of the modal */
|
.device-modal.hidden {
|
||||||
#device-modal-wrapper.opened .device-modal {
|
display: none;
|
||||||
animation: fade-in-and-up 0.3s ease;
|
|
||||||
animation-fill-mode: forwards;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#device-modal-wrapper.closed .device-modal {
|
|
||||||
animation: fade-down-and-out 0.3s ease;
|
|
||||||
animation-fill-mode: forwards;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#device-modal-wrapper.opened .modal-overlay {
|
|
||||||
background-color: var(--theme-splitter-color);
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
z-index: 0;
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.device-modal-content {
|
.device-modal-content {
|
||||||
|
|
|
@ -28,7 +28,7 @@ addRDMTask(TEST_URL, function* ({ ui }) {
|
||||||
uncheckedCb.click();
|
uncheckedCb.click();
|
||||||
closeButton.click();
|
closeButton.click();
|
||||||
|
|
||||||
ok(modal.classList.contains("closed") && !modal.classList.contains("opened"),
|
ok(modal.classList.contains("hidden"),
|
||||||
"The device modal is hidden on exit.");
|
"The device modal is hidden on exit.");
|
||||||
|
|
||||||
info("Check that the device list remains unchanged after exitting.");
|
info("Check that the device list remains unchanged after exitting.");
|
||||||
|
|
|
@ -61,7 +61,7 @@ addRDMTask(TEST_URL, function* ({ ui }) {
|
||||||
uncheckedCb.click();
|
uncheckedCb.click();
|
||||||
submitButton.click();
|
submitButton.click();
|
||||||
|
|
||||||
ok(modal.classList.contains("closed") && !modal.classList.contains("opened"),
|
ok(modal.classList.contains("hidden"),
|
||||||
"The device modal is hidden on submit.");
|
"The device modal is hidden on submit.");
|
||||||
|
|
||||||
info("Checking that the new device is added to the user preference list.");
|
info("Checking that the new device is added to the user preference list.");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче