Bug 1762849 - [devtools] Automatically generate DateTime rep stubs. r=bomsy

Differential Revision: https://phabricator.services.mozilla.com/D142788
This commit is contained in:
Nicolas Chevobbe 2022-04-05 07:47:48 +00:00
Родитель d574e0a2c9
Коммит 14ed677c3e
4 изменённых файлов: 40 добавлений и 25 удалений

Просмотреть файл

@ -34,6 +34,10 @@ const EXPRESSIONS_BY_FILE = {
}`,
],
]),
"date-time.js": new Map([
["DateTime", `new Date(1459372644859)`],
["InvalidDateTime", `new Date("invalid")`],
]),
"infinity.js": new Map([
["Infinity", `Infinity`],
["NegativeInfinity", `-Infinity`],
@ -53,7 +57,6 @@ const EXPRESSIONS_BY_FILE = {
// "accessible.js",
// "accessor.js",
// "big-int.js",
// "date-time.js",
// "document-type.js",
// "document.js",
// "element-node.js",

Просмотреть файл

@ -20,7 +20,7 @@ const { DateTime, Rep } = REPS;
const stubs = require("devtools/client/shared/components/test/node/stubs/reps/date-time");
describe("test DateTime", () => {
const stub = stubs.get("DateTime");
const stub = stubs.get("DateTime")._grip;
it("selects DateTime as expected", () => {
expect(getRep(stub)).toBe(DateTime.rep);
@ -45,7 +45,7 @@ describe("test DateTime", () => {
});
describe("test invalid DateTime", () => {
const stub = stubs.get("InvalidDateTime");
const stub = stubs.get("InvalidDateTime")._grip;
it("renders expected text for invalid date", () => {
const renderedComponent = shallow(

Просмотреть файл

@ -3,34 +3,45 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
"use strict";
/*
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN browser_reps_stubs.js with STUBS_UPDATE=true env TO UPDATE.
*/
const stubs = new Map();
stubs.set("DateTime", {
type: "object",
class: "Date",
actor: "server1.conn0.child1/obj32",
extensible: true,
frozen: false,
sealed: false,
ownPropertyLength: 0,
preview: {
timestamp: 1459372644859,
stubs.set(`DateTime`, {
"_grip": {
"type": "object",
"actor": "server0.conn0.windowGlobal4294967299/obj28",
"class": "Date",
"ownPropertyLength": 0,
"extensible": true,
"frozen": false,
"sealed": false,
"isError": false,
"preview": {
"timestamp": 1459372644859
}
},
"actorID": "server0.conn0.windowGlobal4294967299/obj28"
});
stubs.set("InvalidDateTime", {
type: "object",
actor: "server1.conn0.child1/obj32",
class: "Date",
extensible: true,
frozen: false,
sealed: false,
ownPropertyLength: 0,
preview: {
timestamp: {
type: "NaN",
},
stubs.set(`InvalidDateTime`, {
"_grip": {
"type": "object",
"actor": "server0.conn0.windowGlobal4294967299/obj30",
"class": "Date",
"ownPropertyLength": 0,
"extensible": true,
"frozen": false,
"sealed": false,
"isError": false,
"preview": {
"timestamp": {
"type": "NaN"
}
}
},
"actorID": "server0.conn0.windowGlobal4294967299/obj30"
});
module.exports = stubs;

Просмотреть файл

@ -4,6 +4,7 @@ subsuite = devtools
support-files =
attribute.js
comment-node.js
date-time.js
infinity.js
nan.js
null.js