Bug 1309243 - Use unique key property; r=nchevobbe

This commit is contained in:
Jan Odvarko 2016-10-17 18:11:40 +02:00
Родитель 4e97bb7842
Коммит 7df44c80a0
2 изменённых файлов: 31 добавлений и 4 удалений

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

@ -14,6 +14,8 @@ const PropTypes = React.PropTypes;
* It's essentially a list of name + value pairs.
*/
var NetInfoParams = React.createClass({
displayName: "NetInfoParams",
propTypes: {
params: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
@ -21,8 +23,6 @@ var NetInfoParams = React.createClass({
})).isRequired,
},
displayName: "NetInfoParams",
render() {
let params = this.props.params || [];
@ -31,9 +31,9 @@ var NetInfoParams = React.createClass({
});
let rows = [];
params.forEach(param => {
params.forEach((param, index) => {
rows.push(
DOM.tr({key: param.name},
DOM.tr({key: index},
DOM.td({className: "netInfoParamName"},
DOM.span({title: param.name}, param.name)
),

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

@ -40,3 +40,30 @@ add_task(function* () {
is(paramValue.textContent, "bar",
"The param value must have proper value");
});
/**
* Test URL parameters with the same name.
*/
add_task(function* () {
info("Test XHR Spy params started");
let {hud} = yield addTestTab(TEST_PAGE_URL);
let netInfoBody = yield executeAndInspectXhr(hud, {
method: "GET",
url: JSON_XHR_URL,
queryString: "?box[]=123&box[]=456"
});
// Check headers
let tabBody = yield selectNetInfoTab(hud, netInfoBody, "params");
let params = tabBody.querySelectorAll(
".netInfoParamName > span[title='box[]']");
is(params.length, 2, "Two URI parameters must exist");
let values = tabBody.querySelectorAll(
".netInfoParamValue > code");
is(values[0].textContent, 123, "First value must match");
is(values[1].textContent, 456, "Second value must match");
});