Skip to content

Conversation

naaajii
Copy link
Contributor

@naaajii naaajii commented May 27, 2024

empty ngSwitchCase generate case () { which isn't valid syntax therefore adding quotes will help prevent us migrate empty case if no condition was provided

fix #56030

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #56030

control flow cases being generated with no fallback value in them

What is the new behavior?

control flow cases contain single quotes if ngSwitchCase didnt had any value in it

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from devversion May 27, 2024 17:22
@JeanMeche
Copy link
Member

JeanMeche commented May 27, 2024

Do you mind bringing in the test you had in #56103, thank you ?

@naaajii
Copy link
Contributor Author

naaajii commented May 27, 2024

main branch didnt contain test file for control flow migration, so im not sure where that test would go.

@JeanMeche
Copy link
Member

Oh it looks like the file was (mistakenly ?) removed in #55391
@jessicajaniuk should we restore it ?

@JeanMeche JeanMeche requested review from thePunderWoman and removed request for devversion May 27, 2024 17:35
@naaajii
Copy link
Contributor Author

naaajii commented May 27, 2024

isnt it more like we dont need those tests anymore as it just works - like we wouldnt be needing that migration in v18 as it was for migrating from v17 to v18, now we are just providing fixes for missing cases? apologies if i misunderstood something!

take my word for it, it works on my PC! 😀

@JoostK
Copy link
Member

JoostK commented May 27, 2024

Definitely those tests need to be restored!

@JeanMeche
Copy link
Member

This migration was optional in v17 as control flow was still in developer preview.
We like to have a test coverage for migrations to cover for potential regressions in future changes in the migrations.

@naaajii
Copy link
Contributor Author

naaajii commented May 27, 2024

should i bring them back in this branch or create new one?

@pkozlowski-opensource pkozlowski-opensource added the area: migrations Issues related to `ng update`/`ng generate` migrations label May 28, 2024
@ngbot ngbot bot added this to the Backlog milestone May 28, 2024
@thePunderWoman
Copy link
Contributor

I'll create a PR to restore the tests.

@thePunderWoman
Copy link
Contributor

Looks like @alan-agius4 beat me to it with #56130.

@thePunderWoman
Copy link
Contributor

@naaajii the PR restoring the tests has been merged. Can you rebase and add your test case?

empty ngSwitchCase generate `case ()` which isn't valid syntax therefore adding quotes will help prevent us migrate empty case if no condition was provided

fix angular#56030
@naaajii
Copy link
Contributor Author

naaajii commented May 28, 2024

done!

@thePunderWoman thePunderWoman added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release action: presubmit The PR is in need of a google3 presubmit labels May 28, 2024
Copy link
Contributor

@thePunderWoman thePunderWoman left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for updating this!

@pkozlowski-opensource
Copy link
Member

This PR was merged into the repository by commit 3b2f88c.

pkozlowski-opensource pushed a commit that referenced this pull request May 29, 2024
empty ngSwitchCase generate `case ()` which isn't valid syntax therefore adding quotes will help prevent us migrate empty case if no condition was provided

fix #56030

PR Close #56105
@naaajii naaajii deleted the fix-56030 branch May 29, 2024 17:33
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker action: presubmit The PR is in need of a google3 presubmit area: migrations Issues related to `ng update`/`ng generate` migrations target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Control flow migrations produces broken code when ngSwitchCase is used as text attribute
5 participants