Add tests for String#padStart and String#padEnd#564
Conversation
|
Looking good, @ljharb! The tests look valid, I just have a few ideas for The I like the "observable operations" tests! If you want to get really fancy (and The proposal says "If fillString is The tests that have multi-line descriptions should use |
|
@jugglinmike I'll add separate tests that throw on the ToString and ToLength branches (which the existing observable ops tests ensure are properly called). I'll also add more non-string + falsy fillString values to cover what you've indicated, and fix the multiline descriptions. How could I observe the "hint" behavior of |
Sorry, that was a bit unclear. Here's the text I had in mind:
By defining the -var receiver = createPrimitiveObserver('receiver', 'abc');
+var receiver = createPrimitiveObserver('receiver', {}, 'abc');
-var fillString = createPrimitiveObserver('fillString', 'def');
+var fillString = createPrimitiveObserver('fillString', {}, 'def'); |
|
ah, i see. ok cool, i'll make the changes today |
ea57b61 to
d8cbdf9
Compare
|
Updated! |
|
|
||
| assert.sameValue(log, '|' + [ | ||
| 'toString:receiver', | ||
| 'toString:toPrimitiveABC', |
There was a problem hiding this comment.
I believe valueOf:receive happens here as the result of toString:receive is an Object and the the valueOf will return undefined.
There was a problem hiding this comment.
understood and fixed, thanks!
d8cbdf9 to
3a8d604
Compare
|
|
||
| var maxLength = createPrimitiveObserver('maxLength', {}, 11); | ||
|
|
||
| var result = String.prototype.padEnd.call(receiver, fillString, maxLength); |
There was a problem hiding this comment.
-var result = String.prototype.padEnd.call(receiver, fillString, maxLength);
+var result = String.prototype.padEnd.call(receiver, maxLength, fillString);edit: s/padStart/padEnd
There was a problem hiding this comment.
ops (this is padEnd, not padStart, but the same argument order applies)
e2da4c7 to
2a32b99
Compare
|
LGTM |
2a32b99 to
350f3d1
Compare
|
Squashed and merged at c95e673, thanks! |
|
Thank you! :-D |
(tc39/proposal-string-pad-start-end#23)