зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1374680 - Retrieve indent property from the message in the messages types components; r=bgrins
We don't retrieve the indent from the MessageContainer anymore, but from the lowest-level component where we have access to the full message data, i.e. the messages types components (e.g. ConsoleApi, EvaluationResult, … ). MozReview-Commit-ID: JkaIcxnyt3W --HG-- extra : rebase_source : 3ebe764cae33348d8d807936f5dcad3f23a0aa31
This commit is contained in:
Родитель
7c77ad7be9
Коммит
21012ef14b
|
@ -70,7 +70,7 @@ const MessageContainer = createClass({
|
|||
const message = this.props.getMessage();
|
||||
|
||||
let MessageComponent = getMessageComponent(message);
|
||||
return MessageComponent(Object.assign({message, indent: message.indent}, this.props));
|
||||
return MessageComponent(Object.assign({message}, this.props));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -25,14 +25,12 @@ ConsoleApiCall.propTypes = {
|
|||
message: PropTypes.object.isRequired,
|
||||
open: PropTypes.bool,
|
||||
serviceContainer: PropTypes.object.isRequired,
|
||||
indent: PropTypes.number.isRequired,
|
||||
timestampsVisible: PropTypes.bool.isRequired,
|
||||
loadedObjectProperties: PropTypes.object,
|
||||
};
|
||||
|
||||
ConsoleApiCall.defaultProps = {
|
||||
open: false,
|
||||
indent: 0,
|
||||
};
|
||||
|
||||
function ConsoleApiCall(props) {
|
||||
|
@ -42,13 +40,13 @@ function ConsoleApiCall(props) {
|
|||
open,
|
||||
tableData,
|
||||
serviceContainer,
|
||||
indent,
|
||||
timestampsVisible,
|
||||
repeat,
|
||||
loadedObjectProperties,
|
||||
} = props;
|
||||
const {
|
||||
id: messageId,
|
||||
indent,
|
||||
source,
|
||||
type,
|
||||
level,
|
||||
|
|
|
@ -17,27 +17,22 @@ ConsoleCommand.displayName = "ConsoleCommand";
|
|||
|
||||
ConsoleCommand.propTypes = {
|
||||
message: PropTypes.object.isRequired,
|
||||
indent: PropTypes.number.isRequired,
|
||||
timestampsVisible: PropTypes.bool.isRequired,
|
||||
serviceContainer: PropTypes.object,
|
||||
};
|
||||
|
||||
ConsoleCommand.defaultProps = {
|
||||
indent: 0,
|
||||
};
|
||||
|
||||
/**
|
||||
* Displays input from the console.
|
||||
*/
|
||||
function ConsoleCommand(props) {
|
||||
const {
|
||||
indent,
|
||||
message,
|
||||
timestampsVisible,
|
||||
serviceContainer,
|
||||
} = props;
|
||||
|
||||
const {
|
||||
indent,
|
||||
source,
|
||||
type,
|
||||
level,
|
||||
|
|
|
@ -19,22 +19,16 @@ EvaluationResult.displayName = "EvaluationResult";
|
|||
EvaluationResult.propTypes = {
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
message: PropTypes.object.isRequired,
|
||||
indent: PropTypes.number.isRequired,
|
||||
timestampsVisible: PropTypes.bool.isRequired,
|
||||
serviceContainer: PropTypes.object,
|
||||
loadedObjectProperties: PropTypes.object,
|
||||
};
|
||||
|
||||
EvaluationResult.defaultProps = {
|
||||
indent: 0,
|
||||
};
|
||||
|
||||
function EvaluationResult(props) {
|
||||
const {
|
||||
dispatch,
|
||||
message,
|
||||
serviceContainer,
|
||||
indent,
|
||||
timestampsVisible,
|
||||
loadedObjectProperties,
|
||||
} = props;
|
||||
|
@ -45,6 +39,7 @@ function EvaluationResult(props) {
|
|||
helperType,
|
||||
level,
|
||||
id: messageId,
|
||||
indent,
|
||||
exceptionDocURL,
|
||||
frame,
|
||||
timeStamp,
|
||||
|
|
|
@ -22,17 +22,11 @@ NetworkEventMessage.propTypes = {
|
|||
serviceContainer: PropTypes.shape({
|
||||
openNetworkPanel: PropTypes.func.isRequired,
|
||||
}),
|
||||
indent: PropTypes.number.isRequired,
|
||||
timestampsVisible: PropTypes.bool.isRequired,
|
||||
networkMessageUpdate: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
NetworkEventMessage.defaultProps = {
|
||||
indent: 0,
|
||||
};
|
||||
|
||||
function NetworkEventMessage({
|
||||
indent,
|
||||
message = {},
|
||||
serviceContainer,
|
||||
timestampsVisible,
|
||||
|
@ -40,6 +34,7 @@ function NetworkEventMessage({
|
|||
}) {
|
||||
const {
|
||||
actor,
|
||||
indent,
|
||||
source,
|
||||
type,
|
||||
level,
|
||||
|
|
|
@ -18,14 +18,12 @@ PageError.displayName = "PageError";
|
|||
PageError.propTypes = {
|
||||
message: PropTypes.object.isRequired,
|
||||
open: PropTypes.bool,
|
||||
indent: PropTypes.number.isRequired,
|
||||
timestampsVisible: PropTypes.bool.isRequired,
|
||||
serviceContainer: PropTypes.object,
|
||||
};
|
||||
|
||||
PageError.defaultProps = {
|
||||
open: false,
|
||||
indent: 0,
|
||||
};
|
||||
|
||||
function PageError(props) {
|
||||
|
@ -34,11 +32,11 @@ function PageError(props) {
|
|||
message,
|
||||
open,
|
||||
serviceContainer,
|
||||
indent,
|
||||
timestampsVisible,
|
||||
} = props;
|
||||
const {
|
||||
id: messageId,
|
||||
indent,
|
||||
source,
|
||||
type,
|
||||
level,
|
||||
|
|
|
@ -86,7 +86,10 @@ describe("ConsoleAPICall component:", () => {
|
|||
const message = stubPreparedMessages.get("console.log('foobar', 'test')");
|
||||
|
||||
const indent = 10;
|
||||
let wrapper = render(ConsoleApiCall({ message, serviceContainer, indent }));
|
||||
let wrapper = render(ConsoleApiCall({
|
||||
message: Object.assign({}, message, {indent}),
|
||||
serviceContainer
|
||||
}));
|
||||
expect(wrapper.find(".indent").prop("style").width)
|
||||
.toBe(`${indent * INDENT_WIDTH}px`);
|
||||
|
||||
|
|
|
@ -81,7 +81,9 @@ describe("EvaluationResult component:", () => {
|
|||
const message = stubPreparedMessages.get("new Date(0)");
|
||||
|
||||
const indent = 10;
|
||||
let wrapper = render(EvaluationResult({ message, indent}));
|
||||
let wrapper = render(EvaluationResult({
|
||||
message: Object.assign({}, message, {indent}),
|
||||
}));
|
||||
expect(wrapper.find(".indent").prop("style").width)
|
||||
.toBe(`${indent * INDENT_WIDTH}px`);
|
||||
|
||||
|
|
|
@ -57,7 +57,10 @@ describe("NetworkEventMessage component:", () => {
|
|||
const message = stubPreparedMessages.get("GET request");
|
||||
|
||||
const indent = 10;
|
||||
let wrapper = render(NetworkEventMessage({ message, serviceContainer, indent}));
|
||||
let wrapper = render(NetworkEventMessage({
|
||||
message: Object.assign({}, message, {indent}),
|
||||
serviceContainer
|
||||
}));
|
||||
expect(wrapper.find(".indent").prop("style").width)
|
||||
.toBe(`${indent * INDENT_WIDTH}px`);
|
||||
|
||||
|
|
|
@ -142,7 +142,10 @@ describe("PageError component:", () => {
|
|||
it("has the expected indent", () => {
|
||||
const message = stubPreparedMessages.get("ReferenceError: asdf is not defined");
|
||||
const indent = 10;
|
||||
let wrapper = render(PageError({ message, serviceContainer, indent}));
|
||||
let wrapper = render(PageError({
|
||||
message: Object.assign({}, message, {indent}),
|
||||
serviceContainer
|
||||
}));
|
||||
expect(wrapper.find(".indent").prop("style").width)
|
||||
.toBe(`${indent * INDENT_WIDTH}px`);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче