Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Updated pluralization in bravery panel (shields panel) to handle 0, 1, or more than 1 #4967

Merged
merged 1 commit into from
Oct 20, 2016
Merged

Updated pluralization in bravery panel (shields panel) to handle 0, 1, or more than 1 #4967

merged 1 commit into from
Oct 20, 2016

Conversation

bsclifton
Copy link
Member

@bsclifton bsclifton commented Oct 19, 2016

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Updated pluralization in bravery panel (shields panel) to handle 0, 1, or more than 1

Also-
Hardened tests quite a bit for the Bravery Panel. This includes

  • added new helpers for:
    • waitForTabCount
    • openBraveMenu
    • waitForDataFile
  • added waitForTabCount in places where race condition was present
  • increase timeout for the waitForDataFile portion, which sometimes took longer than 1 second
  • added a logVerbose method to many helper methods. Can be toggled by setting variable "logVerboseEnabled" to true in test/lib/brave.js

NOTE: tests are not included for these strings. I can either add them or create an issue to track this

Fixes #4966

Auditors: @bbondy

Test Plan:

  • Launch Brave, go to https://clifton.io, and open bravery panel
  • Notice that:
    • "Ad or Tracker blocked" is used instead of the plural (since only 1 is present)
    • items with 0 use the plural tense
  • Visit https://brianbondy.com and notice:
    • "Ads or Trackers blocked" is used since there are 3 present

@bbondy
Copy link
Member

bbondy commented Oct 20, 2016

I think the l10n properties files have support for this with something like:

turtles = {[ plural(n) ]}
turtles[zero]  = The earth is not supported by turtles
turtles[one]   = The earth is supported by 1 turtle
turtles[other] = The earth is supported by {{n}} turtles

data-l10n=id='turtles'

@bbondy
Copy link
Member

bbondy commented Oct 20, 2016

We have an in code example here:
findResultMatches

@bsclifton
Copy link
Member Author

bsclifton commented Oct 20, 2016

@bbondy this is great, thanks! 😄 working on a fix now...

…, or more than 1

Also-
Hardened tests quite a bit for the Bravery Panel. This includes
- added new helpers for:
  - waitForTabCount
  - openBraveMenu
  - waitForDataFile
- added waitForTabCount in places where race condition was present
- increase timeout for the waitForDataFile portion, which sometimes took longer than 1 second
- added a logVerbose method to many helper methods. Can be toggled by setting variable "logVerboseEnabled" to true in `test/lib/brave.js`

Fixes #4966

Auditors: @bbondy

Test Plan:
1. Launch Brave, go to https://clifton.io, and open bravery panel
2. Notice that:
  - "Ad or Tracker blocked" is used instead of the plural (since only 1 is present)
  - items with 0 use the plural tense
3. Visit https://brianbondy.com and notice:
  - "Ads or Trackers blocked" is used since there are 3 present
@bsclifton
Copy link
Member Author

Updated and ready for re-review 😄 (sorry about the multiple rebases; wanted to make sure it's nice and clean)

@@ -13,6 +13,14 @@ chai.use(chaiAsPromised)

const Server = require('./server')

// toggle me for more verbose logs! :)
const logVerboseEnabled = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document this in the docs/tests.md

.windowByUrl(Brave.browserWindowUrl)
// .tabByIndex(0)
// .loadUrl(url)
// .url(url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be removed?

@bbondy
Copy link
Member

bbondy commented Oct 20, 2016

looks great, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants