Bug 1244916 - JSON Viewer: empty arrays should hide the zero count. r=odvarko

This commit is contained in:
Dalimil Hajek 2016-07-15 07:52:00 -04:00
parent adfcd55bb8
commit 806745713c
4 changed files with 7 additions and 4 deletions

View File

@ -127,7 +127,8 @@ define(function (require, exports, module) {
let items;
if (mode == "tiny") {
items = DOM.span({className: "length"}, object.length);
let isEmpty = object.length === 0;
items = DOM.span({className: "length"}, isEmpty ? "" : object.length);
} else {
let max = (mode == "short") ? 3 : 300;
items = this.arrayIterator(object, max);

View File

@ -108,7 +108,9 @@ define(function (require, exports, module) {
let items;
if (mode == "tiny") {
items = span({className: "length"}, this.getLength(object));
let objectLength = this.getLength(object);
let isEmpty = objectLength === 0;
items = span({className: "length"}, isEmpty ? "" : objectLength);
} else {
let max = (mode == "short") ? 3 : 300;
items = this.arrayIterator(object, max);

View File

@ -64,7 +64,7 @@ window.onload = Task.async(function* () {
},
{
mode: "tiny",
expectedOutput: `[0]`,
expectedOutput: `[]`,
},
{
mode: "short",

View File

@ -57,7 +57,7 @@ window.onload = Task.async(function* () {
},
{
mode: "tiny",
expectedOutput: `[0]`,
expectedOutput: `[]`,
},
{
mode: "short",