Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

Commit

Permalink
add tests to check that grip, grip-array, grip-map don't forward titl…
Browse files Browse the repository at this point in the history
…e to children
  • Loading branch information
juliandescottes committed Feb 11, 2017
1 parent 76b79e9 commit 06f354c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/mochitest/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ function shallowRenderComponent(component, props) {
*/
function testRepRenderModes(modeTests, testName, componentUnderTest, gripStub,
props = {}) {
modeTests.forEach(({mode, expectedOutput, message}) => {
modeTests.forEach(({mode, expectedOutput, message, title}) => {
const modeString = typeof mode === "undefined" ? "no mode" : mode.toString();
if (!message) {
message = `${testName}: ${modeString} renders correctly.`;
}

const rendered = renderComponent(
componentUnderTest.rep,
Object.assign({}, { object: gripStub, mode }, props)
Object.assign({}, { object: gripStub, mode, title }, props)
);
is(rendered.textContent, expectedOutput, message);
});
Expand Down
7 changes: 7 additions & 0 deletions src/test/mochitest/test_reps_grip-array.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
{
mode: MODE.LONG,
expectedOutput: defaultOutput,
},
{
// Check the custom title with nested objects to make sure nested objects are not
// displayed with their parent's title.
mode: MODE.LONG,
title: "CustomTitle",
expectedOutput: `CustomTitle [ 1, "foo", Object ]`,
}
];

Expand Down
7 changes: 7 additions & 0 deletions src/test/mochitest/test_reps_grip-map.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@
{
mode: MODE.LONG,
expectedOutput: defaultOutput,
},
{
// Check the custom title with nested objects to make sure nested objects are not
// displayed with their parent's title.
mode: MODE.LONG,
title: "CustomTitle",
expectedOutput: `CustomTitle { Object: "value-a" }`,
}
];

Expand Down
7 changes: 7 additions & 0 deletions src/test/mochitest/test_reps_grip.html
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,13 @@
{
mode: MODE.LONG,
expectedOutput: defaultOutput,
},
{
// Check the custom title with nested objects to make sure nested objects are not
// displayed with their parent's title.
mode: MODE.LONG,
title: "CustomTitle",
expectedOutput: `CustomTitle { objProp: Object, strProp: "test string" }`,
}
];

Expand Down

0 comments on commit 06f354c

Please sign in to comment.