forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix nits. r=linclark
- Loading branch information
Showing
11 changed files
with
100 additions
and
7 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
devtools/client/webconsole/new-console-output/components/message-icon.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ | ||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* 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/. */ | ||
|
||
"use strict"; | ||
|
||
// React & Redux | ||
const { | ||
DOM: dom, | ||
PropTypes | ||
} = require("devtools/client/shared/vendor/react"); | ||
const {l10n} = require("devtools/client/webconsole/new-console-output/utils/messages"); | ||
|
||
MessageIcon.displayName = "MessageIcon"; | ||
|
||
MessageIcon.propTypes = { | ||
severity: PropTypes.string.isRequired, | ||
}; | ||
|
||
function MessageIcon(props) { | ||
const { severity } = props; | ||
|
||
const title = l10n.getStr("severity." + severity); | ||
return dom.div({ | ||
className: "icon", | ||
title | ||
}); | ||
} | ||
|
||
module.exports.MessageIcon = MessageIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
devtools/client/webconsole/new-console-output/test/components/test_message-icon.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE HTML> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf8"> | ||
<title>Test for MessageRepeat component</title> | ||
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> | ||
<script type="application/javascript;version=1.8" src="head.js"></script> | ||
<!-- Any copyright is dedicated to the Public Domain. | ||
- http://creativecommons.org/publicdomain/zero/1.0/ --> | ||
</head> | ||
<body> | ||
<p>Test for MessageIcon component</p> | ||
|
||
<script type="text/javascript;version=1.8"> | ||
window.onload = Task.async(function* () { | ||
const { | ||
SEVERITY_CLASS_FRAGMENTS, | ||
SEVERITY_ERROR, | ||
} = require("devtools/client/webconsole/new-console-output/constants"); | ||
const { MessageIcon } = require("devtools/client/webconsole/new-console-output/components/message-icon"); | ||
|
||
let severity = SEVERITY_CLASS_FRAGMENTS[SEVERITY_ERROR]; | ||
const iconRendered = renderComponent(MessageIcon, { severity }); | ||
ok(iconRendered.classList.contains("icon"), "MessageIcon has expected class"); | ||
is(iconRendered.getAttribute("title"), "Error", | ||
"MessageIcon shows correct title attribute"); | ||
|
||
SimpleTest.finish(); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters