-
Notifications
You must be signed in to change notification settings - Fork 1
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
Initial Development #1
Conversation
… UMD definition - Make the README less opinionated about how to use the module - Add to README: DOM element, jQuery element or selector stings as ways to select the element. - Add information about default template to README - Add details about configuration options to README - Add UMD definition to module Branch: MmLRZ2E2-development Branch: MmLRZ2E2-development Branch: MmLRZ2E2-development
Do we need to be concerned at all about what happens when a visitor has JavaScript disabled, or are we leaving that concern up to the developer who use this? |
Branch: MmLRZ2E2-development
"name": "subscribe-email", | ||
"version": "0.0.0", | ||
"private": true, | ||
"main": "subscribe-email.js", |
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 should be src/subscribe-email.js
right?
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.
oops, yep. I moved that and forgot to update package.json. I'll update it with the next commit.
Add support for Universe API Branch: MmLRZ2E2-development Branch: MmLRZ2E2-development
53cdbea
to
79c0cfb
Compare
Concerning email validation, modern browsers validate |
Add an event container to template HTML and add 'subscribe-email-message' event Branch: MmLRZ2E2-development
Yeah I'm fine with relying on the server's own validation / messaging. It's a request, but no biggie. |
setting template to false will now override the template with the markup from the page. Branch: no-template Branch: MmLRZ2E2-development
ca5c493
to
e8b4c40
Compare
\o/ Branch: MmLRZ2E2-development
Branch: MmLRZ2E2-development
I think this works 🙈 Branch: MmLRZ2E2-development
I refactored this as a node-flavored module and then used Browserify's standalone option to build it as a UMD module. @pushred if you want to give this a whirl, you can just add
I think this resolves #2 |
Hmm sadly no.. I'm still seeing all the errors I listed there when Browserify is bundling my project. Confirmed that
|
so browserified module can be browserified without errors Branch: MmLRZ2E2-development
Branch: MmLRZ2E2-development
Branch: MmLRZ2E2-development
include a this instanceof SubscribeEmail check to let people consume the module with new SubscribeEmail or SubscribeEmail() Branch: MmLRZ2E2-development
configuring the hbsfy transform in package.json was causing problems when the module was included as a dependency in other projects. Branch: MmLRZ2E2-development
Add events API, clean up documentation and implementation details Branch: MmLRZ2E2-development
var derequire = require('gulp-derequire'); | ||
|
||
var hbsfy = require('hbsfy').configure({ | ||
extensions: ['hbs'] |
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.
Isn't this only required for custom extensions, i.e. .handlebars
? .hbs
is the usual convention that hbsfy follows.
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.
Good call
update readme, remove unnecessary extensions parameter from browserify, move default template to flatten directory structure Branch: MmLRZ2E2-development
Add a basic test with Tape and Testling Branch: MmLRZ2E2-development
Yeah I had trouble running the tests in IE9 too, and I couldn't find a solution. The tests would run once in a while, but most of the time nothing would happen. I gave up on it for now... |
tests won't run in ie9 without a doctype that triggers standards mode Branch: MmLRZ2E2-development
add event tests to make sure subscriptionMessage, subscriptionError, and subscriptionSuccess are fired when they should be Branch: MmLRZ2E2-development
247 tests passing! \o/ Looks like all tests are passing in all browsers. |
update readme, and remove my personal mailchimp url from tests since it's no longer needed Branch: MmLRZ2E2-development
rather than inserting the template inside of the placeholder, the placeholder is now completely replaced by the template, which means the template contains the entire markup of the subscription form including the form tag itself. Branch: MmLRZ2E2-development
Branch: MmLRZ2E2-development
|
||
if (typeof options.template === 'function') { | ||
instance.template = options.template; | ||
delete options.template; |
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.
Why delete the option? Also, you could just test for if (options.template) {
.
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.
I think originally I was deleting it because I thought it could cause issues to pass options.template
into instance.template
if they were the same thing. (Later, I do instance.template(options);
) But I guess it's not necessary to delete it. I want to check for typeof options.template
because I want to make sure that it's a valid compiled Handlebars template.
namespace module name with "blocks-", update alerter dependency to npm repo instead of github, remove global option from hbsfy transform, remove unnecessary code, update Events test to just test if object has emit method since specific events are tested elsewhere, update custom template test to check that the custom template is used and not just the default, change test API keys to be fake keys, remove duplicate prependMessagesTo docs Branch: MmLRZ2E2-development
namespace module name with "blocks-", update alerter dependency to npm repo instead of github, remove global option from hbsfy transform, remove unnecessary code, update Events test to just test if object has emit method since specific events are tested elsewhere, update custom template test to check that the custom template is used and not just the default, change test API keys to be fake keys, update README by adding better examples and remove duplicate prependMessagesTo docs Branch: MmLRZ2E2-development
…cribe-email into MmLRZ2E2-development
|
||
switch (options.service) { | ||
case 'universe': | ||
options.formAction = options.formAction || 'http://services.sparkart.net/api/v1/contacts'; |
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 should be https
Branch: MmLRZ2E2-development
{browser: 'Chrome'}, | ||
{browser: 'Chrome', browser_version: '35.0'}, | ||
{browser: 'Safari'}, | ||
{browser: 'Safari', browser_version: '6.1'}, |
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.
Safari's up to 8 now, Firefox's at 32, and Chrome's on 38. This'll be a pain to keep in sync across the modules, how about adding a super small module hosted on a repo in this org where we can define these centrally? Also are there any feeds we should be following from BrowserStack for when they add new versions? Would be great to automate that someday, but for now someone can just kick off tests locally whenever a new version is added.
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.
Yeah. The nice part is that the latest version will always be tested by default. It's the previous version that will be difficult to keep in sync. Unfortunately, BrowserStack doesn't have a way of automatically selecting the previous version of a browser. I already contacted their support about this. I'm also not aware of anything except this page that has the latest versions published. I did, however, find browserstack-runner which has a previous version option, and could be useful either to use in our projects or to learn from. I'll look into how it works.
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.
I gave browserstack-runner
a shot, and it's pretty promising, but there are still some issues that will prevent us from switching right away: browserstack/browserstack-runner#94
I've opened an issue here to address this.
Trying the latest locally I'm running into that issue where the Handlebars precompiled template source is rendered into the page where the alert's supposed to go. Checking |
@pushred I found out that that issue is caused by the template being browserified twice. Whether that's because it's in a gulp task and package.json, or applied to the dependent module and then again, globally, from the parent module. So that should help narrow down why you're seeing that, but I'm not able to replicate that finding. Also, which package are you seeing @0.0.2? |
Oops I meant 1.0.2, gotta get used to this insane 1.x versioning! I just removed the global transform I had in my parent project, but now Browserify gets stuck:
Did you forget to push up the transform in this module's config? |
Yeah it's all good once I add that. |
to avoid double transforms that cause the source code text to be rendered into the page Branch: MmLRZ2E2-development
add more descriptive name and better keywords Branch: MmLRZ2E2-development
No description provided.