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

Window.prompt should distinguish between empty Ok and Cancel #540

Closed
midnightmonster opened this issue Apr 10, 2022 · 0 comments · Fixed by #587
Closed

Window.prompt should distinguish between empty Ok and Cancel #540

midnightmonster opened this issue Apr 10, 2022 · 0 comments · Fixed by #587
Labels
bug Something isn't working good first issue Good for newcomers stdlib Standard library related
Milestone

Comments

@midnightmonster
Copy link

// JavaScript
const answer = window.prompt("What's your name?","");
const greeting = answer === null ? "How rude!" : answer ? `Hello, ${answer}!` : "I'll call you Darth";
alert(greeting);
// Mint
sequence {
  greeting = sequence {
    answer = Window.prompt("What's your name?","")
    if(answer == ""){
      "I'll call you Darth" // Never happens
    } else {
      "Hello, #{answer}!"
    }
  } catch String => reason {
    "How rude!"
  }
  Window.alert(greeting)
}

In JavaScript, if the User selects 'Ok' without entering anything, the alert is "I'll call you Darth". In Mint, that condition never happens.

@Sija Sija changed the title Window.prompt should distinguish between empty Ok and Cancel Window.prompt should distinguish between empty Ok and Cancel Apr 10, 2022
@gdotdesign gdotdesign added bug Something isn't working good first issue Good for newcomers stdlib Standard library related labels Apr 11, 2022
@gdotdesign gdotdesign linked a pull request Apr 26, 2023 that will close this issue
@gdotdesign gdotdesign added this to the 0.18.0 milestone May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers stdlib Standard library related
Development

Successfully merging a pull request may close this issue.

2 participants