-
Notifications
You must be signed in to change notification settings - Fork 643
Switch to binary prefixes #7218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dcfde83
Change: `pretty-bytes`: specify `binary: true` option
kanarus 6ce48bc
Add: doc comment & test
kanarus e57b7aa
Update: doc comment
kanarus f6199a7
Fix: format
kanarus 379af63
Fix: format
kanarus 0542ed2
Run: `pnpm prettier`
kanarus 937a1a1
Fix: reference URL: to use fixed tag
kanarus 1d3fdbb
Fix: `components/version-list`: specify `text-transform: none` in `.b…
kanarus 152f411
Fix: `prettyBytes` options inh helper: specify in ahead of `...options`
kanarus 1cf5862
Fix: `prettyBytes` helper: not set franction digits to 1 & Fix test
kanarus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,6 +211,7 @@ | |
|
||
.bytes { | ||
font-variant-numeric: tabular-nums; | ||
text-transform: none; | ||
} | ||
|
||
.feature-list { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { render } from '@ember/test-helpers'; | ||
import { module, test } from 'qunit'; | ||
|
||
import { hbs } from 'ember-cli-htmlbars'; | ||
|
||
import { setupRenderingTest } from 'cargo/tests/helpers'; | ||
|
||
module('Unit | Helper | pretty-bytes', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it displays as expected', async function (assert) { | ||
this.owner.lookup('service:intl').locale = 'en'; | ||
|
||
await render(hbs`{{pretty-bytes 42}}`); | ||
assert.dom().hasText('42 B'); | ||
|
||
await render(hbs`{{pretty-bytes 1024}}`); | ||
assert.dom().hasText('1 KiB'); | ||
|
||
// 4200 / 1024 = 4.101... | ||
await render(hbs`{{pretty-bytes 4200}}`); | ||
assert.dom().hasText('4.1 KiB'); | ||
|
||
// 4200 / 1024 = 4.142... | ||
await render(hbs`{{pretty-bytes 4242}}`); | ||
assert.dom().hasText('4.14 KiB'); | ||
|
||
// 42000 / 1024 = 41.0156... | ||
await render(hbs`{{pretty-bytes 42000}}`); | ||
assert.dom().hasText('41 KiB'); | ||
|
||
// 42623 / 1024 = 41.625 | ||
await render(hbs`{{pretty-bytes 42624}}`); | ||
assert.dom().hasText('41.6 KiB'); | ||
|
||
// 424242 / 1024 = 414.2988... | ||
await render(hbs`{{pretty-bytes 424242}}`); | ||
assert.dom().hasText('414 KiB'); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Turbo87, what's the point of "making it possible to override these defaults", if it is never (AFAIU) overridden anywhere?
In #7177 (comment) I intentionally wrote
{...options, binary: true}
so that binary prefixes will be anywhere and everywhere (that was the point from the start).