Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Unified Diff: chrome/browser/resources/print_preview/data/ticket_items/page_range.js

Issue 2862203002: Print Preview: Fix data/ errors (Closed)
Patch Set: Make tests pass Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/data/ticket_items/page_range.js
diff --git a/chrome/browser/resources/print_preview/data/ticket_items/page_range.js b/chrome/browser/resources/print_preview/data/ticket_items/page_range.js
index db20e71f1f7646ce6258dcb93e5b100a5ebdd9f6..d6f8cb6e48d8d78917e2ea2172c3ab5d46271de8 100644
--- a/chrome/browser/resources/print_preview/data/ticket_items/page_range.js
+++ b/chrome/browser/resources/print_preview/data/ticket_items/page_range.js
@@ -20,7 +20,7 @@ cr.define('print_preview.ticket_items', function() {
null /*field*/,
null /*destinationStore*/,
documentInfo);
- };
+ }
/**
* Impossibly large page number.
@@ -46,7 +46,7 @@ cr.define('print_preview.ticket_items', function() {
*/
getPageNumberSet: function() {
var pageNumberList = pageRangeTextToPageList(
- this.getValue(), this.getDocumentInfoInternal().pageCount);
+ this.getValueAsString_(), this.getDocumentInfoInternal().pageCount);
return new print_preview.PageNumberSet(pageNumberList);
},
@@ -66,23 +66,31 @@ cr.define('print_preview.ticket_items', function() {
},
/**
+ * @return {string} The value of the ticket item as a string
dpapad 2017/05/05 17:32:51 Nit: Period missing at the end.
rbpotter 2017/05/05 18:25:46 Done.
+ * @private
+ */
+ getValueAsString_: function() {
+ return /** @type {string} */(this.getValue());
+ },
+
+ /**
* @return {!Array<Object<{from: number, to: number}>>} A list of page
* ranges.
*/
getPageRanges: function() {
- var pageRanges = pageRangeTextToPageRanges(this.getValue());
+ var pageRanges = pageRangeTextToPageRanges(this.getValueAsString_());
return pageRanges instanceof Array ? pageRanges : [];
},
/**
- * @return {!Array<object<{from: number, to: number}>>} A list of page
+ * @return {!Array<Object<{from: number, to: number}>>} A list of page
* ranges suitable for use in the native layer.
* TODO(vitalybuka): this should be removed when native layer switched to
* page ranges.
*/
getDocumentPageRanges: function() {
var pageRanges = pageRangeTextToPageRanges(
- this.getValue(), this.getDocumentInfoInternal().pageCount);
+ this.getValueAsString_(), this.getDocumentInfoInternal().pageCount);
return pageRanges instanceof Array ? pageRanges : [];
},
@@ -98,7 +106,7 @@ cr.define('print_preview.ticket_items', function() {
*/
checkValidity: function() {
var pageRanges = pageRangeTextToPageRanges(
- this.getValue(), this.getDocumentInfoInternal().pageCount);
+ this.getValueAsString_(), this.getDocumentInfoInternal().pageCount);
return pageRanges instanceof Array ?
PageRangeStatus.NO_ERROR : pageRanges;
},

Powered by Google App Engine
This is Rietveld 408576698