-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add a bunch of test cases for autofill autoprompt #89
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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,54 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Autofill autoprompt for signin forms</title> | ||
<link rel="stylesheet" href="../style.css" /> | ||
</head> | ||
|
||
<body> | ||
<p><a href="../index.html">[Home]</a></p> | ||
<nav> | ||
<ul class="nav"> | ||
<li><a href="./case-1.html">Case 1</a></li> | ||
<li><a href="./case-2.html">Case 2</a></li> | ||
<li><a href="./case-3.html">Case 3</a></li> | ||
<li><a href="./case-4.html">Case 4</a></li> | ||
<li><a href="./case-5.html">Case 5</a></li> | ||
</ul> | ||
</nav> | ||
|
||
<p id="demo"></p> | ||
|
||
<div class=""> | ||
<p>Sign in form present on pageload (<b>should prompt automatically</b>).</p> | ||
|
||
<div class="dialog"> | ||
<form id="click-form" novalidate> | ||
<h3>Sign in form</h3> | ||
<fieldset> | ||
<label for="email">Email</label> | ||
<input id="email" type="email"> | ||
<label for="password">Password</label> | ||
<input id="password" type="password"> | ||
<button type="submit">Sign in</button> | ||
</fieldset> | ||
</form> | ||
</div> | ||
<script> | ||
const clickForm = document.getElementById('click-form'); | ||
const button = clickForm?.querySelector('button'); | ||
const handler = (e) => { | ||
e.preventDefault(); | ||
e.stopImmediatePropagation(); | ||
clickForm.outerHTML = '<h1>Submitted!</h1>'; | ||
} | ||
button?.addEventListener('click', handler, true); | ||
</script> | ||
</div> | ||
|
||
</body> | ||
|
||
</html> |
This file contains 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,59 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Autofill autoprompt for signin forms</title> | ||
<link rel="stylesheet" href="../style.css" /> | ||
</head> | ||
|
||
<body> | ||
<p><a href="../index.html">[Home]</a></p> | ||
<nav> | ||
<ul class="nav"> | ||
<li><a href="./case-1.html">Case 1</a></li> | ||
<li><a href="./case-2.html">Case 2</a></li> | ||
<li><a href="./case-3.html">Case 3</a></li> | ||
<li><a href="./case-4.html">Case 4</a></li> | ||
<li><a href="./case-5.html">Case 5</a></li> | ||
</ul> | ||
</nav> | ||
|
||
<p id="demo"></p> | ||
|
||
<div class=""> | ||
<p>Form created in modal after click (<b>should not prompt automatically</b>).</p> | ||
|
||
<div class="dialog"> | ||
<p><button type="button">Click here to login</button></p> | ||
</div> | ||
<script> | ||
const initialButton = document.querySelector('button'); | ||
initialButton.addEventListener('click', () => { | ||
const formEl = `<form id="click-form" novalidate action="./case-3.html"> | ||
<h3>Sign in form dia</h3> | ||
<fieldset> | ||
<label for="email">Email</label> | ||
<input id="email" type="email"> | ||
<label for="password">Password</label> | ||
<input id="password" type="password"> | ||
<button type="submit">Sign in</button> | ||
</fieldset> | ||
</form>` | ||
initialButton.outerHTML = formEl; | ||
const clickForm = document.getElementById('click-form'); | ||
const button = clickForm?.querySelector('button'); | ||
const handler = (e) => { | ||
e.preventDefault(); | ||
e.stopImmediatePropagation(); | ||
window.location.href = './case-3.html' | ||
} | ||
button?.addEventListener('click', handler, true); | ||
}) | ||
</script> | ||
</div> | ||
|
||
</body> | ||
|
||
</html> |
This file contains 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,67 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Autofill autoprompt for signin forms</title> | ||
<link rel="stylesheet" href="../style.css" /> | ||
</head> | ||
|
||
<body> | ||
<p><a href="../index.html">[Home]</a></p> | ||
<nav> | ||
<ul class="nav"> | ||
<li><a href="./case-1.html">Case 1</a></li> | ||
<li><a href="./case-2.html">Case 2</a></li> | ||
<li><a href="./case-3.html">Case 3</a></li> | ||
<li><a href="./case-4.html">Case 4</a></li> | ||
<li><a href="./case-5.html">Case 5</a></li> | ||
</ul> | ||
</nav> | ||
|
||
<p id="demo"></p> | ||
|
||
<div class="dialog"> | ||
<p>Login form with a multistep flow. It should prompt automatically on first load, then the second field triggers the prompt on tap/click.</p> | ||
<form action="/login" id="login"> | ||
<h2>Log in</h2> | ||
<fieldset> | ||
<label for="email">Email</label> | ||
<input id="email" type="email" required> | ||
<button type="button">Continue</button> | ||
</fieldset> | ||
<fieldset class="password-container" hidden> | ||
<label for="password">Password</label> | ||
<input id="password" type="password" required> | ||
<button type="submit">Log in</button> | ||
</fieldset> | ||
</form> | ||
</div> | ||
|
||
<script type="module"> | ||
const continueButton = document.querySelector('button[type=button]'); | ||
const submitButton = document.querySelector('button[type=submit]'); | ||
const passwordContainer = document.querySelector('.password-container'); | ||
|
||
continueButton.addEventListener('click', () => { | ||
if (form.email.validity.valid) { | ||
passwordContainer.removeAttribute('hidden'); | ||
continueButton.setAttribute('hidden', ''); | ||
} | ||
}); | ||
|
||
const form = document.forms.login; | ||
form.addEventListener('submit', (e) => { | ||
e.preventDefault(); | ||
if (form.checkValidity()) { | ||
setTimeout(() => { | ||
form.outerHTML = '<h1>Submitted!</h1>'; | ||
}, 100); | ||
} | ||
}); | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |
This file contains 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,65 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Autofill autoprompt for signin forms</title> | ||
<link rel="stylesheet" href="../style.css" /> | ||
</head> | ||
|
||
<body> | ||
<p><a href="../index.html">[Home]</a></p> | ||
<nav> | ||
<ul class="nav"> | ||
<li><a href="./case-1.html">Case 1</a></li> | ||
<li><a href="./case-2.html">Case 2</a></li> | ||
<li><a href="./case-3.html">Case 3</a></li> | ||
<li><a href="./case-4.html">Case 4</a></li> | ||
<li><a href="./case-5.html">Case 5</a></li> | ||
</ul> | ||
</nav> | ||
|
||
<p id="demo">The cookie dialog will prevent autoprompt. You should not see an autoprompt on this page. Once dismissing the cookie dialog, you can use the form as usual.</p> | ||
|
||
<div class="dialog"> | ||
<form action="/login" id="login"> | ||
<h2>Log in</h2> | ||
<fieldset> | ||
<label for="email">Email</label> | ||
<input id="email" type="email"> | ||
<label for="password">Password</label> | ||
<input id="password" type="password"> | ||
<button type="submit">Log in</button> | ||
</fieldset> | ||
</form> | ||
</div> | ||
|
||
<div class="dialog dialog--cookie-dialog" hidden> | ||
<h2>Annoying cookie prompt</h2> | ||
<h3>This cookie prompt will appear with a slight delay after page load. It will cover our beloved login form thus preventing autoprompt.</h3> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p> | ||
<p><button type="button" class="close-cookie-dialog">Accept all cookies, you have no choice</button></p> | ||
</div> | ||
<script type="module"> | ||
const cookieDialog = document.querySelector('.dialog--cookie-dialog'); | ||
const closeCookieDialogBtn = document.querySelector('.close-cookie-dialog'); | ||
closeCookieDialogBtn.addEventListener('click', () => cookieDialog.setAttribute('hidden', '')); | ||
|
||
// show the cookie prompt after page load | ||
setTimeout(() => cookieDialog.removeAttribute('hidden'), 100); | ||
|
||
const form = document.forms.login; | ||
form.addEventListener('submit', (e) => { | ||
e.preventDefault(); | ||
if (form.checkValidity()) { | ||
setTimeout(() => { | ||
form.outerHTML = '<h1>Submitted!</h1>'; | ||
}, 100); | ||
} | ||
}); | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |
This file contains 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,62 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Autofill autoprompt for signin forms</title> | ||
<link rel="stylesheet" href="../style.css" /> | ||
</head> | ||
|
||
<body> | ||
<p><a href="../index.html">[Home]</a></p> | ||
<nav> | ||
<ul class="nav"> | ||
<li><a href="./case-1.html">Case 1</a></li> | ||
<li><a href="./case-2.html">Case 2</a></li> | ||
<li><a href="./case-3.html">Case 3</a></li> | ||
<li><a href="./case-4.html">Case 4</a></li> | ||
<li><a href="./case-5.html">Case 5</a></li> | ||
</ul> | ||
</nav> | ||
|
||
<p id="demo"></p> | ||
<p>Sign in form present below the fold on mobile, but in a sidebar on larger screens (<strong>should prompt automatically only when visible, i.e. on desktop</strong>).</p> | ||
|
||
<div class="container"> | ||
<div class="main"> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p> | ||
|
||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p> | ||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </p> | ||
</div> | ||
|
||
<div class="sidebar"> | ||
<form id="click-form" novalidate> | ||
<h3>Sign in form</h3> | ||
<fieldset> | ||
<label for="email">Email</label> | ||
<input id="email" type="email"> | ||
<label for="password">Password</label> | ||
<input id="password" type="password"> | ||
<button type="submit">Sign in</button> | ||
</fieldset> | ||
</form> | ||
</div> | ||
|
||
<script> | ||
const clickForm = document.getElementById('click-form'); | ||
const button = clickForm?.querySelector('button'); | ||
const handler = (e) => { | ||
e.preventDefault(); | ||
e.stopImmediatePropagation(); | ||
clickForm.outerHTML = '<h1>Submitted!</h1>'; | ||
} | ||
button?.addEventListener('click', handler, true); | ||
</script> | ||
</div> | ||
|
||
</body> | ||
|
||
</html> |
Oops, something went wrong.
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.
this doesn't work because we are two levels deep (autofill/autoprompt/). Same for all test case pages.