Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

feat(firstrun): Add fx_firstrun_v2 events to support new firstrun flow. #4717

Merged
merged 2 commits into from Feb 13, 2017

Conversation

shane-tomlinson
Copy link

@shane-tomlinson shane-tomlinson commented Feb 13, 2017

Add several new events that are reported to the parent IFRAME:

  • navigated called whenever the user opens a new page
  • form_enabled called whenever the form is enabled
  • form_disabled called whenever the form is disabled
  • form_engaged called whenever the user modifies an input element

A lot of unit test suites needed to be updated to create the Views with
a notifier reference.

fixes https://github.com/mozilla/fxa-bugzilla-mirror/issues/239

@vladikoff - r?

@@ -15,20 +15,101 @@ define(function (require, exports, module) {
const _ = require('underscore');
const Constants = require('lib/constants');
const FxFirstrunV1AuthenticationBroker = require('./fx-firstrun-v1');
const NotifierMixin = require('views/mixins/notifier-mixin');
Copy link
Author

Choose a reason for hiding this comment

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

I didn't want to add more than this PR than necessary, but it's time to move this mixin into a shared location so it can be used by either views or models without the wonkiness of including a view mixin in a model. I'll do that as a separate PR.

Copy link
Author

Choose a reason for hiding this comment

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

This move was taken care of by @philbooth in #4718

enableForm () {
this.$('button[type=submit]').removeClass('disabled');
this._isFormEnabled = true;
if (! this.isFormEnabled()) {
Copy link
Author

Choose a reason for hiding this comment

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

To avoid sending form.disabled and form.enabled every time either of these methods is called (which is pretty often), I only send the messages if a state change occurs.

isFormEnabled () {
return !! this._isFormEnabled;
return ! this.$('button[type=submit]').hasClass('disabled');
Copy link
Author

Choose a reason for hiding this comment

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

This is modified to checking the DOM instead of relying on an internal variable because sometimes the form is disabled from the template.

@shane-tomlinson
Copy link
Author

The failing travis tests are the /legal/privacy server tests that @vladikoff fixed in #4713

vladikoff and others added 2 commits February 13, 2017 13:39
Add several new events that are reported to the parent IFRAME:

* `navigated` called whenever the user opens a new page
* `form_enabled` called whenever the form is enabled
* `form_disabled` called whenever the form is disabled
* `form_engaged` called whenever the user modifies an input element

A lot of unit test suites needed to be updated to create the Views with
a notifier reference.
@ericawright
Copy link

If it's relevant, I don't need the form_engaged message for mozilla/bedrock#4664

@shane-tomlinson
Copy link
Author

Thanks @ericawright, I'll keep the extra event in for now - the code is in production.

@shane-tomlinson shane-tomlinson deleted the more-firstrun-events branch February 14, 2017 13:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants