Skip to content
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

fix(kit): InputFlies new value of i18n-token TUI_INPUT_FILE_TEXTS triggers text changes #2711

Merged
merged 3 commits into from
Sep 15, 2022

Conversation

nsbarsukov
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows Conventional Commits
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactoring
  • Code style update
  • Build or CI related changes
  • Documentation content changes

What is the current behavior?

Closes #2709

What is the new behavior?

You can dynamically change language of error messages for rejected files.

Does this PR introduce a breaking change?

  • Yes
  • No

@lumberjack-bot
Copy link

lumberjack-bot bot commented Sep 15, 2022

Pull request was closed ✔️

All saved screenshots (for current PR) were deleted 🗑️

@nsbarsukov nsbarsukov added the v3 label Sep 15, 2022
@nsbarsukov nsbarsukov changed the title fix(kit): InputFlies no text changes with new value of i18n-token TUI_INPUT_FILE_TEXTS fix(kit): InputFlies trigger text changes with new value of i18n-token TUI_INPUT_FILE_TEXTS Sep 15, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2022

Visit the preview URL for this PR (updated for commit 2cd06ac):

https://taiga-ui--pr2711-input-files-i18n-fix-c1e3bg58.web.app

(expires Fri, 16 Sep 2022 14:42:10 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

@nsbarsukov nsbarsukov changed the title fix(kit): InputFlies trigger text changes with new value of i18n-token TUI_INPUT_FILE_TEXTS fix(kit): InputFlies new value of i18n-token TUI_INPUT_FILE_TEXTS triggers text changes Sep 15, 2022
Comment on lines 143 to 151
@tuiPure
getMaxSizeRejectionError$(maxFileSize: number): Observable<string> {
return combineLatest([this.inputFileTexts$, this.units$]).pipe(
map(
([{maxSizeRejectionReason}, units]) =>
maxSizeRejectionReason + tuiFormatSize(units, maxFileSize),
),
);
}
Copy link
Member

Choose a reason for hiding this comment

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

can make it better in a separate pipe?

<ng-template #maxSizeRejection>
    {{ maxFileSize | maxSizeRejectionError | async ?? '' }}
</ng-template>

Copy link
Member Author

Choose a reason for hiding this comment

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

done ✅

@codecov
Copy link

codecov bot commented Sep 15, 2022

Codecov Report

Merging #2711 (2cd06ac) into main (4e0bfd6) will decrease coverage by 0.01%.
The diff coverage is 14.28%.

@@            Coverage Diff             @@
##             main    #2711      +/-   ##
==========================================
- Coverage   56.68%   56.67%   -0.02%     
==========================================
  Files         955      956       +1     
  Lines        9233     9237       +4     
  Branches     1894     1894              
==========================================
+ Hits         5234     5235       +1     
- Misses       3588     3591       +3     
  Partials      411      411              
Flag Coverage Δ
addon-charts 73.64% <ø> (ø)
addon-doc 19.12% <ø> (ø)
addon-editor 28.82% <ø> (ø)
addon-mobile ∅ <ø> (∅)
addon-table 83.78% <ø> (ø)
addon-tablebars ∅ <ø> (∅)
cdk 62.87% <ø> (ø)
core 62.86% <ø> (ø)
kit 61.50% <14.28%> (-0.05%) ⬇️
summary 56.67% <14.28%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...it/components/input-files/input-files.component.ts 16.17% <0.00%> (+0.23%) ⬆️
...s/kit/components/input-files/input-files.module.ts 100.00% <ø> (ø)
...nents/input-files/max-size-rejection-error.pipe.ts 20.00% <20.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.


cy.get(`#demoContent tui-file`)
.should(`contain.text`, `Wrong file type`)
.matchImageSnapshot(`01-01-input-files-[english]-wrong-file-type`);
Copy link
Member Author

Choose a reason for hiding this comment

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

1-01-01-input-files- english -wrong-file-type snap


cy.get(`#demoContent tui-file`)
.should(`contain.text`, `Verkeerd bestandsformaat`)
.matchImageSnapshot(`01-02-input-files-[dutch]-wrong-file-type`);
Copy link
Member Author

Choose a reason for hiding this comment

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

1-01-02-input-files- dutch -wrong-file-type snap


cy.get(`#demoContent tui-file`)
.should(`contain.text`, `File is too large 2 KB`)
.matchImageSnapshot(`02-01-input-files-[english]-file-too-large`);
Copy link
Member Author

Choose a reason for hiding this comment

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

1-02-01-input-files- english -file-too-large snap


cy.get(`#demoContent tui-file`)
.should(`contain.text`, `Bestandsgrootte overschreden 2 KB`)
.matchImageSnapshot(`02-02-input-files-[dutch]-file-too-large`);
Copy link
Member Author

Choose a reason for hiding this comment

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

1-02-02-input-files- dutch -file-too-large snap

@splincode splincode merged commit fa4e1e1 into main Sep 15, 2022
@splincode splincode deleted the input-files-i18n-fix branch September 15, 2022 16:03
@well-done-bot
Copy link

well-done-bot bot commented Sep 15, 2022

'Well done'

nsbarsukov added a commit that referenced this pull request Sep 16, 2022
… triggers text changes (#2711)

Cherry-picked from `v3.x`
nsbarsukov added a commit that referenced this pull request Sep 16, 2022
… triggers text changes (#2711)

Cherry-picked from `v3.x`
splincode pushed a commit that referenced this pull request Sep 16, 2022
… triggers text changes (#2716)

* fix(kit): `InputFlies` new value of i18n-token `TUI_INPUT_FILE_TEXTS` triggers text changes (#2711)

Cherry-picked from `v3.x`

* chore: legacy angular fix

* chore(demo-integrations): fix util `tuiSetLanguage`
This was referenced Sep 16, 2022
evantrimboli pushed a commit to evantrimboli/taiga-ui that referenced this pull request Sep 20, 2022
… triggers text changes (taiga-family#2711)

* fix(kit): `InputFlies` no text changes with new value of i18n-token `TUI_INPUT_FILE_TEXTS`

* chore(demo-integrations): new cypress tests

* refactor: create `tuiMaxSizeRejectionError`-pipe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

🐞 - InputFlies no text changes with new value of TUI_INPUT_FILE_TEXTS (i18n-token)
2 participants