mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1286864 - Reps: array should show how many items is not displayed. r=Honza
This commit is contained in:
parent
4a28de030e
commit
6d2ac9fc7e
@ -32,7 +32,7 @@ define(function (require, exports, module) {
|
||||
let items = [];
|
||||
let delim;
|
||||
|
||||
for (let i = 0; i < array.length && i <= max; i++) {
|
||||
for (let i = 0; i < array.length && i < max; i++) {
|
||||
try {
|
||||
let value = array[i];
|
||||
|
||||
@ -61,14 +61,12 @@ define(function (require, exports, module) {
|
||||
}
|
||||
|
||||
if (array.length > max) {
|
||||
items.pop();
|
||||
|
||||
let objectLink = this.props.objectLink || DOM.span;
|
||||
items.push(Caption({
|
||||
key: "more",
|
||||
object: objectLink({
|
||||
object: this.props.object
|
||||
}, "more…")
|
||||
}, (array.length - max) + " more…")
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ define(function (require, exports, module) {
|
||||
let delim;
|
||||
let provider = this.props.provider;
|
||||
|
||||
for (let i = 0; i < array.length && i <= max; i++) {
|
||||
for (let i = 0; i < array.length && i < max; i++) {
|
||||
try {
|
||||
let itemGrip = array[i];
|
||||
let value = provider ? provider.getValue(itemGrip) : itemGrip;
|
||||
@ -89,13 +89,12 @@ define(function (require, exports, module) {
|
||||
}
|
||||
|
||||
if (array.length > max) {
|
||||
items.pop();
|
||||
let objectLink = this.props.objectLink || span;
|
||||
items.push(Caption({
|
||||
key: "more",
|
||||
object: objectLink({
|
||||
object: this.props.object
|
||||
}, "more…")
|
||||
}, (grip.preview.length - max) + " more…")
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ define(function (require, exports, module) {
|
||||
key: "more",
|
||||
object: objectLink({
|
||||
object: object
|
||||
}, "more…")
|
||||
}, ((object ? object.ownPropertyLength : 0) - max) + " more…")
|
||||
}));
|
||||
} else if (props.length > 0) {
|
||||
// Remove the last comma.
|
||||
|
@ -78,7 +78,7 @@ define(function (require, exports, module) {
|
||||
key: "more",
|
||||
object: objectLink({
|
||||
object: object
|
||||
}, "more…")
|
||||
}, (Object.keys(object).length - max) + " more…")
|
||||
}));
|
||||
} else if (props.length > 0) {
|
||||
// Remove the last comma.
|
||||
|
@ -107,7 +107,7 @@ window.onload = Task.async(function* () {
|
||||
|
||||
function testMoreThanShortMaxProps() {
|
||||
const stub = Array(maxLength.short + 1).fill("foo");
|
||||
const defaultShortOutput = `[${Array(maxLength.short).fill("\"foo\"").join(", ")}, more…]`;
|
||||
const defaultShortOutput = `[${Array(maxLength.short).fill("\"foo\"").join(", ")}, 1 more…]`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@ -133,8 +133,8 @@ window.onload = Task.async(function* () {
|
||||
|
||||
function testMoreThanLongMaxProps() {
|
||||
const stub = Array(maxLength.long + 1).fill("foo");
|
||||
const defaultShortOutput = `[${Array(maxLength.short).fill("\"foo\"").join(", ")}, more…]`;
|
||||
const defaultLongOutput = `[${Array(maxLength.long).fill("\"foo\"").join(", ")}, more…]`;
|
||||
const defaultShortOutput = `[${Array(maxLength.short).fill("\"foo\"").join(", ")}, ${maxLength.long + 1 - maxLength.short} more…]`;
|
||||
const defaultLongOutput = `[${Array(maxLength.long).fill("\"foo\"").join(", ")}, 1 more…]`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@ -194,7 +194,7 @@ window.onload = Task.async(function* () {
|
||||
p4: "s4"
|
||||
}
|
||||
];
|
||||
const defaultOutput = `[Object{p1: "s1", p3: "s3", p4: "s4", more…}]`;
|
||||
const defaultOutput = `[Object{p1: "s1", p3: "s3", p4: "s4", 1 more…}]`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ window.onload = Task.async(function* () {
|
||||
// Test array = `["test string"…] //4 items`
|
||||
const testName = "testMoreThanShortMaxProps";
|
||||
|
||||
const defaultOutput = `Array[${Array(maxLength.short).fill("\"test string\"").join(", ")}, more…]`;
|
||||
const defaultOutput = `Array[${Array(maxLength.short).fill("\"test string\"").join(", ")}, 1 more…]`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@ -134,8 +134,8 @@ window.onload = Task.async(function* () {
|
||||
// Test array = `["test string"…] //301 items`
|
||||
const testName = "testMoreThanLongMaxProps";
|
||||
|
||||
const defaultShortOutput = `Array[${Array(maxLength.short).fill("\"test string\"").join(", ")}, more…]`;
|
||||
const defaultLongOutput = `Array[${Array(maxLength.long).fill("\"test string\"").join(", ")}, more…]`;
|
||||
const defaultShortOutput = `Array[${Array(maxLength.short).fill("\"test string\"").join(", ")}, ${maxLength.long + 1 - maxLength.short} more…]`;
|
||||
const defaultLongOutput = `Array[${Array(maxLength.long).fill("\"test string\"").join(", ")}, 1 more…]`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
@ -100,10 +100,10 @@ window.onload = Task.async(function* () {
|
||||
}
|
||||
|
||||
function testMoreThanMaxProps() {
|
||||
// Test object = `{p0: "0", p1: "1", p2: "2", …, p101: "101"}`
|
||||
// Test object = `{p0: "0", p1: "1", p2: "2", …, p100: "100"}`
|
||||
const testName = "testMoreThanMaxProps";
|
||||
|
||||
const defaultOutput = `Object {p0: "0", p1: "1", p2: "2", more…}`;
|
||||
const defaultOutput = `Object {p0: "0", p1: "1", p2: "2", 98 more…}`;
|
||||
|
||||
// Generate string with 100 properties, which is the max limit
|
||||
// for 'long' mode.
|
||||
@ -112,7 +112,7 @@ window.onload = Task.async(function* () {
|
||||
props += "p" + i + ": \"" + i + "\", ";
|
||||
}
|
||||
|
||||
const longOutput = `Object {${props}more…}`;
|
||||
const longOutput = `Object {${props}1 more…}`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@ -140,7 +140,7 @@ window.onload = Task.async(function* () {
|
||||
// Test object: `{a: undefined, b: undefined, c: "c", d: 1}`
|
||||
// @TODO This is not how we actually want the preview to be output.
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1276376
|
||||
const expectedOutput = `Object {a: undefined, b: undefined, c: "c", more…}`;
|
||||
const expectedOutput = `Object {a: undefined, b: undefined, c: "c", 1 more…}`;
|
||||
}
|
||||
|
||||
function testNestedObject() {
|
||||
|
@ -101,7 +101,7 @@ window.onload = Task.async(function* () {
|
||||
for (let i = 0; i<100; i++) {
|
||||
stub[`p${i}`] = i
|
||||
}
|
||||
const defaultOutput = `Object{p0: 0, p1: 1, p2: 2, more…}`;
|
||||
const defaultOutput = `Object{p0: 0, p1: 1, p2: 2, 97 more…}`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@ -127,7 +127,7 @@ window.onload = Task.async(function* () {
|
||||
|
||||
function testUninterestingProps() {
|
||||
const stub = {a:undefined, b:undefined, c:"c", d:0};
|
||||
const defaultOutput = `Object{c: "c", d: 0, a: undefined, more…}`;
|
||||
const defaultOutput = `Object{c: "c", d: 0, a: undefined, 1 more…}`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user