create stream: Improve click handler for Create.

We want to avoid submit handlers here, because we may
have embedded widgets that have their own forms or
buttons.

We use "finalize" here to distinguish the two Create
buttons related to streams.  You hit one button to
start the UI and then the second button to finalize
the process.

I also fix the bad test idiom of clicking on the
sea-green button.
This commit is contained in:
Steve Howell 2022-02-15 20:16:10 +00:00 committed by Tim Abbott
parent e8ad76f522
commit 67fe782714
3 changed files with 3 additions and 3 deletions

View File

@ -175,7 +175,7 @@ async function create_stream(page: Page): Promise<void> {
await wait_for_checked(page, "cordelia", true); await wait_for_checked(page, "cordelia", true);
await wait_for_checked(page, "desdemona", true); // Add desdemona back as we did unset all in last test. await wait_for_checked(page, "desdemona", true); // Add desdemona back as we did unset all in last test.
await wait_for_checked(page, "othello", false); await wait_for_checked(page, "othello", false);
await page.click("form#stream_creation_form button.button.sea-green"); await page.click("form#stream_creation_form .finalize_create_stream");
await page.waitForFunction(() => $(".stream-name").is(':contains("Puppeteer")')); await page.waitForFunction(() => $(".stream-name").is(':contains("Puppeteer")'));
const stream_name = await common.get_text_from_selector( const stream_name = await common.get_text_from_selector(
page, page,

View File

@ -446,7 +446,7 @@ export function set_up_handlers() {
container.on("change", "#make-invite-only input", update_announce_stream_state); container.on("change", "#make-invite-only input", update_announce_stream_state);
container.on("submit", "#stream_creation_form", (e) => { container.on("click", ".finalize_create_stream", (e) => {
e.preventDefault(); e.preventDefault();
clear_error_display(); clear_error_display();

View File

@ -55,7 +55,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="button small white rounded" data-dismiss="modal">{{t "Cancel" }}</button> <button class="button small white rounded" data-dismiss="modal">{{t "Cancel" }}</button>
<button class="button small sea-green rounded" type="submit">{{t "Create" }}</button> <button class="finalize_create_stream button small sea-green rounded" type="submit">{{t "Create" }}</button>
</div> </div>
</form> </form>
</div> </div>