Bug 1574831 - Pass the object to onDOMNodeMouseOut in the reps. r=nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D42444

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gabriel Luong 2019-08-20 17:11:12 +00:00
Родитель 0e392d0f13
Коммит 31be15ff62
11 изменённых файлов: 21 добавлений и 4 удалений

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

@ -65,7 +65,7 @@ function ElementNode(props) {
if (onDOMNodeMouseOut) {
Object.assign(baseConfig, {
onMouseOut: onDOMNodeMouseOut,
onMouseOut: _ => onDOMNodeMouseOut(object),
});
}

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

@ -160,6 +160,7 @@ describe("ElementNode - Node", () => {
renderedComponent.simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(1);
expect(onDOMNodeMouseOut.mock.calls[0][0]).toEqual(stub);
});
it("calls the expected function when mouseover is fired on Rep", () => {

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

@ -126,6 +126,7 @@ describe("Event - mouse event", () => {
node.simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(1);
expect(onDOMNodeMouseOut.mock.calls[0][0]).toEqual(grips[0]);
});
it("calls the expected function when mouseover is fired on Rep", () => {

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

@ -386,6 +386,9 @@ describe("GripArray - NodeList", () => {
node.at(2).simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(3);
expect(onDOMNodeMouseOut.mock.calls[0][0]).toBe(grips[0]);
expect(onDOMNodeMouseOut.mock.calls[1][0]).toBe(grips[1]);
expect(onDOMNodeMouseOut.mock.calls[2][0]).toBe(grips[2]);
});
it("calls the expected function on click", () => {

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

@ -147,6 +147,7 @@ describe("GripMapEntry - complex", () => {
node.simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(1);
expect(onDOMNodeMouseOut.mock.calls[0][0]).toEqual(stub);
node.simulate("mouseover");
expect(onDOMNodeMouseOver.mock.calls).toHaveLength(1);
@ -172,6 +173,7 @@ describe("GripMapEntry - complex", () => {
node.simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(2);
expect(onDOMNodeMouseOut.mock.calls[1][0]).toEqual(stub);
node.simulate("mouseover");
expect(onDOMNodeMouseOver.mock.calls).toHaveLength(2);

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

@ -236,6 +236,9 @@ describe("GripMap - Node-keyed entries", () => {
node.at(2).simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(3);
expect(onDOMNodeMouseOut.mock.calls[0][0]).toBe(grips[0]);
expect(onDOMNodeMouseOut.mock.calls[1][0]).toBe(grips[1]);
expect(onDOMNodeMouseOut.mock.calls[2][0]).toBe(grips[2]);
});
it("calls the expected function on click", () => {
@ -292,6 +295,9 @@ describe("GripMap - Node-valued entries", () => {
node.at(2).simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(3);
expect(onDOMNodeMouseOut.mock.calls[0][0]).toBe(grips[0]);
expect(onDOMNodeMouseOut.mock.calls[1][0]).toBe(grips[1]);
expect(onDOMNodeMouseOut.mock.calls[2][0]).toBe(grips[2]);
});
it("calls the expected function on click", () => {

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

@ -380,6 +380,8 @@ describe("Grip - Object with connected nodes", () => {
node.at(1).simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(2);
expect(onDOMNodeMouseOut.mock.calls[0][0]).toBe(grips[0]);
expect(onDOMNodeMouseOut.mock.calls[1][0]).toBe(grips[1]);
});
it("calls the expected function on click", () => {

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

@ -129,6 +129,7 @@ describe("Promise - fulfilled with node", () => {
node.simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(1);
expect(onDOMNodeMouseOut).toHaveBeenCalledWith(grips[0]);
});
it("no inspect icon when the node is not connected to the DOM tree", () => {

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

@ -70,6 +70,7 @@ describe("TextNode", () => {
wrapper.simulate("mouseout");
expect(onDOMNodeMouseOut.mock.calls).toHaveLength(1);
expect(onDOMNodeMouseOut).toHaveBeenCalledWith(object);
});
it("displays a button when the node is connected", () => {

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

@ -49,7 +49,7 @@ function TextNode(props) {
if (onDOMNodeMouseOut) {
Object.assign(baseConfig, {
onMouseOut: onDOMNodeMouseOut,
onMouseOut: _ => onDOMNodeMouseOut(grip),
});
}

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

@ -6925,7 +6925,7 @@ function ElementNode(props) {
if (onDOMNodeMouseOut) {
Object.assign(baseConfig, {
onMouseOut: onDOMNodeMouseOut
onMouseOut: _ => onDOMNodeMouseOut(object)
});
}
@ -7112,7 +7112,7 @@ function TextNode(props) {
if (onDOMNodeMouseOut) {
Object.assign(baseConfig, {
onMouseOut: onDOMNodeMouseOut
onMouseOut: _ => onDOMNodeMouseOut(grip)
});
}