diff --git a/.eslintrc b/.eslintrc
index 1c27329e479..78a3f9fdbc9 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -149,9 +149,9 @@
"beforeColon": false,
"afterColon": true
}],
- "new-cap": [2, { // http://eslint.org/docs/rules/new-cap
+ "new-cap": [0, { // http://eslint.org/docs/rules/new-cap (turned off for now, as it complains on all Match)
"newIsCap": true,
- "capIsNewExceptions": ["Optional"],
+ "capIsNewExceptions": ["Match", "OneOf", "Optional"],
}],
"no-multiple-empty-lines": [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
"max": 2
diff --git a/.meteor/versions b/.meteor/versions
index 197e9059a53..f970c8dd9ab 100644
--- a/.meteor/versions
+++ b/.meteor/versions
@@ -1,9 +1,13 @@
accounts-base@1.2.1
accounts-facebook@1.0.6
+accounts-github@1.0.6
+accounts-google@1.0.6
accounts-oauth@1.1.7
accounts-password@1.1.3
-alanning:roles@1.2.13
-aldeed:autoform@5.5.1
+accounts-twitter@1.0.6
+accounts-weibo@1.0.6
+alanning:roles@1.2.14
+aldeed:autoform@5.6.0
aldeed:collection2@2.5.0
aldeed:simple-schema@1.3.3
aldeed:template-extension@3.4.3
@@ -68,6 +72,8 @@ facebook@1.2.2
fastclick@1.0.7
fortawesome:fontawesome@4.4.0
geojson-utils@1.0.4
+github@1.1.4
+google@1.1.6
hot-code-push@1.0.0
html-tools@1.0.5
htmljs@1.0.5
@@ -78,8 +84,8 @@ iron:core@1.0.8
iron:dynamic-template@1.0.8
iron:layout@1.0.8
iron:location@1.0.9
-iron:middleware-stack@1.0.9
-iron:router@1.0.9
+iron:middleware-stack@1.0.10
+iron:router@1.0.10
iron:url@1.0.9
jparker:crypto-core@0.1.0
jparker:crypto-md5@0.1.1
@@ -111,10 +117,11 @@ npm-mongo@1.4.39_1
npm-node-aes-gcm@0.1.3_6
oauth@1.1.6
oauth-encryption@1.0.6
+oauth1@1.1.5
oauth2@1.1.5
observe-sequence@1.0.7
ongoworks:bunyan-logger@2.5.0
-ongoworks:security@1.2.0
+ongoworks:security@1.3.0
ongoworks:speakingurl@5.0.1
ordered-dict@1.0.4
promise@0.5.0
@@ -123,15 +130,15 @@ raix:ui-dropped-event@0.0.7
random@1.0.4
rate-limit@1.0.0
reactioncommerce:bootstrap-theme@1.6.0
-reactioncommerce:core@0.8.0
-reactioncommerce:core-theme@1.7.0
-reactioncommerce:reaction-accounts@1.1.0
+reactioncommerce:core@0.9.0
+reactioncommerce:core-theme@1.8.0
+reactioncommerce:reaction-accounts@1.2.0
reactioncommerce:reaction-analytics@1.1.0
reactioncommerce:reaction-analytics-libs@1.1.0
-reactioncommerce:reaction-paypal@1.1.0
+reactioncommerce:reaction-paypal@1.2.0
reactioncommerce:reaction-shipping@0.6.0
reactioncommerce:reaction-social@0.4.0
-reactioncommerce:reaction-stripe@2.1.0
+reactioncommerce:reaction-stripe@2.2.0
reactive-dict@1.1.2
reactive-var@1.0.6
reload@1.1.4
@@ -149,6 +156,7 @@ standard-minifiers@1.0.1
templating@1.1.4
templating-tools@1.0.0
tracker@1.0.9
+twitter@1.1.5
ui@1.0.8
underscore@1.0.4
underscorestring:underscore.string@3.2.2
@@ -157,3 +165,4 @@ utilities:avatar@0.9.2
utilities:spin@2.3.1
webapp@1.2.2
webapp-hashing@1.0.5
+weibo@1.1.4
diff --git a/common/config.js b/common/config.js
index e0e5c2f4979..5a7658b9fc0 100644
--- a/common/config.js
+++ b/common/config.js
@@ -8,3 +8,9 @@ Avatar.setOptions({
fallbackType: "image",
cssClassPrefix: "reactionAvatar"
});
+// client configuration
+if (Meteor.isClient) {
+ ITEMS_INCREMENT = 10;
+ // sets default number of product displayed on a grid
+ Session.setDefault("productScrollLimit", ITEMS_INCREMENT);
+}
diff --git a/docs/developer/globals.md b/docs/developer/globals.md
index 58decda2680..1946da8b77a 100644
--- a/docs/developer/globals.md
+++ b/docs/developer/globals.md
@@ -10,7 +10,7 @@ ReactionCore.Collections = {}; //Collections defined in common/collections
ReactionCore.Helpers = {}; //Misc.helpers defined in common/helpers
ReactionCore.MetaData = {}; // SEO, Metadata object
ReactionCore.Locale = {}; //i18n translation object
-ReactionCore.Events = {}; // Logger instantiation (server)
+ReactionCore.Log = {}; // Logger instantiation (server)
```
_core/common/collections/products.js:_
diff --git a/docs/developer/i18n.md b/docs/developer/i18n.md
index 01dde4f0f72..f0ee8c42a07 100644
--- a/docs/developer/i18n.md
+++ b/docs/developer/i18n.md
@@ -5,7 +5,7 @@ We use the [http://i18next.com/](http://i18next.com/) i18n library for translati
- usage - template helper: `{{i18n 'cartDrawer.empty' 'Your cart is empty.'}}`
- usage - reference: `cartSubTotals.head`
- usage - implied tag: `
Item Count | `
-- usage - alerts `Alerts.add "Message!", "danger", i18n_key: "productDetail.outOfStock"`
+- usage - alerts `Alerts.add "Message!", "danger", i18nKey: "productDetail.outOfStock"`
- usage - js `i18n.t(gridPackage.pkgDisabled)`
_Keys should be camelCase, no spaces, no periods._
diff --git a/docs/developer/logging.md b/docs/developer/logging.md
index 4aeea315486..6171c2d3a48 100644
--- a/docs/developer/logging.md
+++ b/docs/developer/logging.md
@@ -2,7 +2,7 @@
## Bunyan
[Bunyan](//github.com/trentm/node-bunyan) provides a JSON friendly log handler in Reaction Core.
-The ongoworks:bunyan package exports `loggers`, and is instantiated by the `ReactionCore.Events` global that can be used anywhere in Reaction code.
+The ongoworks:bunyan package exports `loggers`, and is instantiated by the `ReactionCore.Log` global that can be used anywhere in Reaction code.
To enable logging set/add `isDebug: true` in `settings.json`. Value can be any valid `bunyan level` in settings.json, or true/false.
@@ -28,5 +28,5 @@ Example:
```
-ReactionCore.Events.info "Something we want to see during development"
+ReactionCore.Log.info "Something we want to see during development"
```
diff --git a/docs/developer/methods.md b/docs/developer/methods.md
index 0ad352ddcd8..508efb0d43a 100644
--- a/docs/developer/methods.md
+++ b/docs/developer/methods.md
@@ -160,20 +160,20 @@ Usage:
Meteor.call "updateMetaFields", productId
```
-### cloneVariant
-The cloneVariant method copies variants, but will also create and clone child variants (options)
+### products/cloneVariant
+The products/cloneVariant method copies variants, but will also create and clone child variants (options)
Usage:
```
# to clone a variant
-Meteor.call "cloneVariant", productId, variantId
+Meteor.call "products/cloneVariant", productId, variantId
# to create a child option from a variant
-Meteor.call "cloneVariant", productId, variantId, parentId
+Meteor.call "products/cloneVariant", productId, variantId, parentId
```
-cloneVariant takes a product id, a variant id to clone a variant. Adding a parent id will make the new clone as an option of that parent.
+products/cloneVariant takes a product id, a variant id to clone a variant. Adding a parent id will make the new clone as an option of that parent.
### updateVariant
The updateVariant method updates an individual variant with new values and merges into the original.
diff --git a/docs/developer/overview.md b/docs/developer/overview.md
index 34fe77df712..4a3c8e6e236 100644
--- a/docs/developer/overview.md
+++ b/docs/developer/overview.md
@@ -17,9 +17,9 @@ See [themes.md](themes.md) for details on the themes and LESS implementation.
### Logging
Client and server logging.
-- `ReactionCore.Events.info("This is some info")`
-- `ReactionCore.Events.warn("Warn Will Robinson")`
-- `ReactionCore.Events.debug("Stuff", stuffObject)`
+- `ReactionCore.Log.info("This is some info")`
+- `ReactionCore.Log.warn("Warn Will Robinson")`
+- `ReactionCore.Log.debug("Stuff", stuffObject)`
More options and use examples at [logging.md](logging.md).
diff --git a/docs/developer/routing.md b/docs/developer/routing.md
index c67e273b0b8..95932d68e86 100644
--- a/docs/developer/routing.md
+++ b/docs/developer/routing.md
@@ -1,5 +1,6 @@
# Routing
-[*common/routing.coffee](//github.com/reactioncommerce/reaction/blob/master/common/routing.coffee) can be customized to change layouts.
+
+[*common/routing.js](https://github.com/reactioncommerce/reaction/blob/master/common/routing.js) can be customized to change layouts.
If you are adding reaction-core to your own meteor application, `iron:router` is installed as a dependency of `reactioncommerce:core`.
diff --git a/docs/developer/templates.md b/docs/developer/templates.md
index 1363b6cb367..958f994f68a 100644
--- a/docs/developer/templates.md
+++ b/docs/developer/templates.md
@@ -1,7 +1,7 @@
# Templates
To add or change features, or make non CSS layout updates you can create your own templates. [Iron Router](//github.com/EventedMind/iron-router) manages paths, layouts, and which templates load where.
-Review the [Iron Router docs](//github.com/EventedMind/iron-router/blob/devel/DOCS.md) for background information, then reference the file [_packages/reaction-core/common/routing.coffee_](//github.com/reactioncommerce/reaction-core/blob/master/common/routing.coffee). Here you will be able to see how all the default routes, paths, and template layouts are configured.
+Review the [Iron Router docs](https://github.com/EventedMind/iron-router/blob/devel/DOCS.md) for background information, then reference the file [_packages/reaction-core/common/routing.js](https://github.com/reactioncommerce/reaction-core/blob/master/common/routing.js). Here you will be able to see how all the default routes, paths, and template layouts are configured.
## Extending and customizing templates
To extend and customize the html for any reaction/meteor template, add a template extension map to `client/templates.coffee`
diff --git a/server/fixtures.js b/server/fixtures.js
index c6143f35d06..2d0d643ad01 100644
--- a/server/fixtures.js
+++ b/server/fixtures.js
@@ -1,13 +1,13 @@
/**
-* Reaction startup
-*
-* Load app private fixtures
-*/
+ * Reaction startup
+ *
+ * Load app private fixtures
+ */
-Meteor.startup(function() {
+Meteor.startup(function () {
try {
return Fixtures.loadSettings(Assets.getText("settings/reaction.json"));
} catch (error) {
- ReactionCore.Events.debug("loadSettings reaction.json not loaded.", error);
+ ReactionCore.Log.debug("loadSettings reaction.json not loaded.", error);
}
});
diff --git a/tests/jasmine/client/integration/cartSpecs.js b/tests/jasmine/client/integration/cartSpecs.js
index 071cb289ca1..c087d6ba66b 100644
--- a/tests/jasmine/client/integration/cartSpecs.js
+++ b/tests/jasmine/client/integration/cartSpecs.js
@@ -1,17 +1,17 @@
-/*Product Detail Page Specs*/
-describe("Cart", function() {
- beforeEach(function(done) {
- Router.go('/product/example-product');
+/* Product Detail Page Specs*/
+describe("Cart", function () {
+ beforeEach(function (done) {
+ Router.go("/product/example-product");
Tracker.afterFlush(done);
});
beforeEach(waitForRouter);
// add to cart from pdp
- describe("Add to cart", function() {
+ describe("Add to cart", function () {
// empty cart items before each test
- afterEach(function(done) {
- var cartId = ReactionCore.Collections.Cart.findOne()._id;
+ afterEach(function (done) {
+ let cartId = ReactionCore.Collections.Cart.findOne()._id;
ReactionCore.Collections.Cart.update({
_id: cartId
}, {
@@ -22,114 +22,106 @@ describe("Cart", function() {
done();
});
- it("should not add to cart without option selected", function() {
+ it("should not add to cart without option selected", function () {
// no option is selected yet
- $('#add-to-cart').trigger('click');
+ $("#add-to-cart").trigger("click");
// check alert
- expect($('#product-alerts div:first-child').text()).not.toBeNull();
+ expect($("#product-alerts div:first-child").text()).not.toBeNull();
});
- it("should add selected option to cart", function(done) {
- var option1 = $('.variant-product-options .variant-select-option')[0];
- var addToCartButton = $('#add-to-cart');
- var cartCount = $('.cart-icon .badge').text();
- var cartId = ReactionCore.Collections.Cart.findOne()._id;
+ it("should add selected option to cart", function (done) {
+ let option1 = $(".letiant-product-options .letiant-select-option")[0];
+ let addToCartButton = $("#add-to-cart");
// needs client stubs
- /*var spyOnCart = spyOn(ReactionCore.Collections.Cart, 'update').and.returnValue();*/
+ /* let spyOnCart = spyOn(ReactionCore.Collections.Cart, "update").and.returnValue();*/
- var spyOnOptionEvent = spyOnEvent(option1, 'click');
- var spyOnAddToCartEvent = spyOnEvent(addToCartButton, 'click');
+ let spyOnOptionEvent = spyOnEvent(option1, "click");
+ let spyOnAddToCartEvent = spyOnEvent(addToCartButton, "click");
- $(option1).trigger('click');
+ $(option1).trigger("click");
- expect('click').toHaveBeenTriggeredOn(option1);
+ expect("click").toHaveBeenTriggeredOn(option1);
expect(spyOnOptionEvent).toHaveBeenTriggered();
- $(addToCartButton).trigger('click');
+ $(addToCartButton).trigger("click");
expect(spyOnAddToCartEvent).toHaveBeenTriggered();
- /*expect(spyOnCart).toHaveBeenCalled();*/
+ /* expect(spyOnCart).toHaveBeenCalled();*/
done();
});
+ it("should let the quantity for selected option be changed", function () {
+ let option1 = $(".letiant-product-options .letiant-select-option")[0];
+ let addToCartButton = $("#add-to-cart");
- it("should let the quantity for selected option be changed", function() {
- var option1 = $('.variant-product-options .variant-select-option')[0];
- var addToCartButton = $('#add-to-cart');
- var cartCount = $('.cart-icon .badge').text();
+ let spyOnOptionEvent = spyOnEvent(option1, "click");
+ let spyOnAddToCartEvent = spyOnEvent(addToCartButton, "click");
- var spyOnOptionEvent = spyOnEvent(option1, 'click');
- var spyOnAddToCartEvent = spyOnEvent(addToCartButton, 'click');
+ $("#add-to-cart-quantity").val(22);
+ $(option1).trigger("click");
- $('#add-to-cart-quantity').val(22);
- $(option1).trigger('click');
-
- expect('click').toHaveBeenTriggeredOn(option1);
+ expect("click").toHaveBeenTriggeredOn(option1);
expect(spyOnOptionEvent).toHaveBeenTriggered();
- $(addToCartButton).trigger('click');
+ $(addToCartButton).trigger("click");
expect(spyOnAddToCartEvent).toHaveBeenTriggered();
});
- it("should throw an error if not enough quantity", function() {
- var option1 = $('.variant-product-options .variant-select-option')[0];
- var addToCartButton = $('#add-to-cart');
- var cartCount = $('.cart-icon .badge').text();
+ it("should throw an error if not enough quantity", function () {
+ let option1 = $(".letiant-product-options .letiant-select-option")[0];
+ let addToCartButton = $("#add-to-cart");
+ let cartCount = $(".cart-icon .badge").text();
- var spyOnOptionEvent = spyOnEvent(option1, 'click');
- var spyOnAddToCartEvent = spyOnEvent(addToCartButton, 'click');
+ let spyOnOptionEvent = spyOnEvent(option1, "click");
+ let spyOnAddToCartEvent = spyOnEvent(addToCartButton, "click");
- $('#add-to-cart-quantity').val(2002);
- $(option1).trigger('click');
+ $("#add-to-cart-quantity").val(2002);
+ $(option1).trigger("click");
- expect('click').toHaveBeenTriggeredOn(option1);
+ expect("click").toHaveBeenTriggeredOn(option1);
expect(spyOnOptionEvent).toHaveBeenTriggered();
- $(addToCartButton).trigger('click');
+ $(addToCartButton).trigger("click");
expect(spyOnAddToCartEvent).toHaveBeenTriggered();
- expect($('.cart-icon .badge').text()).toEqual(cartCount);
-
+ expect($(".cart-icon .badge").text()).toEqual(cartCount);
});
- it("should not add to cart without variant/option selected", function() {
+ it("should not add to cart without letiant/option selected", function () {
// no option is selected yet
- $('#add-to-cart').trigger('click');
+ $("#add-to-cart").trigger("click");
// check alert
- expect($('#product-alerts div:first-child').text()).not.toBeNull();
+ expect($("#product-alerts div:first-child").text()).not.toBeNull();
});
- it("should add selected variant/option to cart", function() {
- var option1 = $('.variant-product-options .variant-select-option')[0];
- var addToCartButton = $('#add-to-cart');
- var cartCount = $('.cart-icon .badge').text();
- var spyOnOptionEvent = spyOnEvent(option1, 'click');
- var spyOnAddToCartEvent = spyOnEvent(addToCartButton, 'click');
+ it("should add selected option to cart", function () {
+ let option1 = $(".letiant-product-options .letiant-select-option")[0];
+ let addToCartButton = $("#add-to-cart");
+ let spyOnOptionEvent = spyOnEvent(option1, "click");
+ let spyOnAddToCartEvent = spyOnEvent(addToCartButton, "click");
- $(option1).trigger('click');
+ $(option1).trigger("click");
- expect('click').toHaveBeenTriggeredOn(option1);
+ expect("click").toHaveBeenTriggeredOn(option1);
expect(spyOnOptionEvent).toHaveBeenTriggered();
- $('#add-to-cart').trigger('click');
+ $("#add-to-cart").trigger("click");
expect(spyOnAddToCartEvent).toHaveBeenTriggered();
});
- it("should goto checkout when checkout button clicked ", function(done) {
- var btnCheckout = $('#btn-checkout');
- var cartIcon = $('.cart-icon');
+ it("should goto checkout when checkout button clicked ", function (done) {
+ let btnCheckout = $("#btn-checkout");
+ let cartIcon = $(".cart-icon");
- var spyOnCheckoutButton = spyOnEvent(btnCheckout, 'click');
- var spyOnCartIcon = spyOnEvent(cartIcon, 'click');
+ let spyOnCheckoutButton = spyOnEvent(btnCheckout, "click");
+ let spyOnCartIcon = spyOnEvent(cartIcon, "click");
- $(cartIcon).trigger('click');
+ $(cartIcon).trigger("click");
expect(spyOnCartIcon).toHaveBeenTriggered();
- $('#btn-checkout').trigger('click');
+ $("#btn-checkout").trigger("click");
expect(spyOnCheckoutButton).toHaveBeenTriggered();
- /*expect(Router.current().url).toEqual("/checkout");*/
+ /* expect(Router.current().url).toEqual("/checkout");*/
done();
});
-
});
-
});
diff --git a/tests/jasmine/client/integration/checkoutSpecs.js b/tests/jasmine/client/integration/checkoutSpecs.js
index a0534031953..4572af6ad1a 100644
--- a/tests/jasmine/client/integration/checkoutSpecs.js
+++ b/tests/jasmine/client/integration/checkoutSpecs.js
@@ -1,47 +1,45 @@
-var checkoutState = function (callback) {
+function checkoutState(callback) {
if (callback) {
- var cartId = ReactionCore.Collections.Cart.findOne()._id;
+ let cartId = ReactionCore.Collections.Cart.findOne()._id;
cartWorkflow = ReactionCore.Collections.Cart.findOne(cartId).workflow;
Tracker.afterFlush(callback);
}
-};
-var originalTimeout;
+}
describe("Checkout", function () {
beforeEach(function (done) {
spyOn(ReactionCore.Collections.Cart, "update");
Meteor.autorun(function (c) {
- var status = ReactionCore.Collections.Cart.findOne().workflow.status;
+ let status = ReactionCore.Collections.Cart.findOne().workflow.status;
if (status) {
c.stop();
checkoutState(done);
}
});
- Router.go('/checkout');
+ Router.go("/checkout");
Tracker.afterFlush(done);
});
beforeEach(waitForRouter);
describe("checkoutLogin", function () {
-
it("should go to checkout route", function (done) {
expect(Router.current().url).toEqual("/checkout");
done();
});
-
it("should display i18n empty checkout msg if no products", function (done) {
expect(Router.current().url).toEqual("/checkout");
- var cartItems = ReactionCore.Collections.Cart.findOne().items;
+ let cartItems = ReactionCore.Collections.Cart.findOne().items;
if (!cartItems) {
- expect($('*[data-i18n="cartCheckout.emptyCheckoutCart"]')).toHaveText('looks like your cart is empty!');
+ expect($("*[data-i18n='cartCheckout.emptyCheckoutCart']")).toHaveText(
+ "looks like your cart is empty!");
} else {
- expect($('*[data-i18n="cartCheckout.emptyCheckoutCart"]')).not.toExist();
+ expect($("*[data-i18n='cartCheckout.emptyCheckoutCart']")).not.toExist();
}
done();
@@ -50,12 +48,12 @@ describe("Checkout", function () {
it("should display guest user login", function (done) {
expect(Router.current().url).toEqual("/checkout");
- var thisStep = (cartWorkflow.status === "checkoutLogin" || cartWorkflow.status === "new");
- var thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutLogin");
+ let thisStep = cartWorkflow.status === "checkoutLogin" || cartWorkflow.status === "new";
+ let thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutLogin");
// if this step is already process, we expect the workflow.workflow
// to already contain this step, and not to see the login flow
if (thisStep && !thisWorkflow) {
- expect($('.continue-guest')).toExist();
+ expect($(".continue-guest")).toExist();
} else {
expect(cartWorkflow.workflow).toContain("checkoutLogin");
}
@@ -65,13 +63,13 @@ describe("Checkout", function () {
it("should continue as a guest user", function (done) {
expect(Router.current().url).toEqual("/checkout");
- var thisStep = (cartWorkflow.status === "checkoutLogin" || cartWorkflow.status === "new");
- var thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutLogin");
+ let thisStep = cartWorkflow.status === "checkoutLogin" || cartWorkflow.status === "new";
+ let thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutLogin");
if (thisStep && !thisWorkflow) {
- var guestGo = $('.continue-guest');
+ let guestGo = $(".continue-guest");
// test guest login button
- $('.continue-guest').trigger('click');
+ $(".continue-guest").trigger("click");
expect(guestGo).toHandle("click");
expect(ReactionCore.Collections.Cart.update).toHaveBeenCalled();
@@ -80,38 +78,36 @@ describe("Checkout", function () {
}
done();
});
-
});
describe("checkoutAddressBook", function () {
-
it("should add primary address to addressBook", function () {
expect(Router.current().url).toEqual("/checkout");
- var thisStep = (cartWorkflow.status === "checkoutAddressBook");
- var thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutAddressBook");
- var spyOnSaveButton = spyOnEvent( $('*[data-event-action="saveAddress"]', 'click'));
+ let thisStep = cartWorkflow.status === "checkoutAddressBook";
+ let thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutAddressBook");
+ // let spyOnSaveButton = spyOnEvent($("*[data-event-action='saveAddress']", "click"));
if (thisStep === true && thisWorkflow === false) {
expect(cartWorkflow.status).toEqual("checkoutAddressBook");
- var fakeAddress = faker.reaction.address();
-
- $('*[data-event-action="addNewAddress"]').trigger("click");
-
- $('select[name="country"]').val(fakeAddress.country);
- $('input[name="fullName"]').focus();
- $('input[name="fullName"]').val(fakeAddress.fullName);
- $('input[name="address1"]').val(fakeAddress.address1);
- $('input[name="address2"]').val(fakeAddress.address2);
- $('input[name="city"]').val(fakeAddress.city);
- $('input[name="postal"]').val(fakeAddress.postal);
- $('input[name="region"]').val(fakeAddress.region);
- $('input[name="phone"]').val(fakeAddress.phone);
-
- $('*[data-event-action="saveAddress"]').trigger("click");
- /*expect(spyOnSaveButton).toHaveBeenTriggered();
- expect($('*[data-event-action="saveAddress"]')).toHandle("click");
- expect(ReactionCore.Collections.Cart.update).toHaveBeenCalled();*/
+ let fakeAddress = faker.reaction.address();
+
+ $("*[data-event-action='addNewAddress']").trigger("click");
+
+ $("select[name='country']").val(fakeAddress.country);
+ $("input[name='fullName']").focus();
+ $("input[name='fullName']").val(fakeAddress.fullName);
+ $("input[name='address1']").val(fakeAddress.address1);
+ $("input[name='address2']").val(fakeAddress.address2);
+ $("input[name='city']").val(fakeAddress.city);
+ $("input[name='postal']").val(fakeAddress.postal);
+ $("input[name='region']").val(fakeAddress.region);
+ $("input[name='phone']").val(fakeAddress.phone);
+
+ $("*[data-event-action='saveAddress']").trigger("click");
+ // expect(spyOnSaveButton).toHaveBeenTriggered();
+ // expect($("*[data-event-action="saveAddress"]")).toHandle("click");
+ // expect(ReactionCore.Collections.Cart.update).toHaveBeenCalled();
} else {
expect(cartWorkflow.workflow).not.toContain("checkoutAddressBook");
}
@@ -120,79 +116,69 @@ describe("Checkout", function () {
it("should add secondary address to addressBook", function () {
expect(Router.current().url).toEqual("/checkout");
- var thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutAddressBook");
+ let thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutAddressBook");
// if addressbook has succeeded at least once
if (thisWorkflow && cartWorkflow.workflow.indexOf("checkoutAddressBook") > 1) {
- console.log("add secondary addressBook: ", cartWorkflow.status);
- var fakeAddress = faker.reaction.address();
+ ReactionCore.Log.info("add secondary addressBook: ", cartWorkflow.status);
+ let fakeAddress = faker.reaction.address();
- $('*[data-event-action="addNewAddress"]').trigger("click");
- expect($('*[data-event-action="addNewAddress"]')).toHandle("click");
+ $("*[data-event-action='addNewAddress']").trigger("click");
+ expect($("*[data-event-action='addNewAddress']")).toHandle("click");
- $('select[name="country"]').val(fakeAddress.country);
- $('input[name="fullName"]').focus();
+ $("select[name='country']").val(fakeAddress.country);
+ $("input[name='fullName']").focus();
+ $("input[name='fullName']").val(fakeAddress.fullName);
+ $("input[name='address1']").val(fakeAddress.address1);
+ $("input[name='address2']").val(fakeAddress.address2);
+ $("input[name='city']").val(fakeAddress.city);
+ $("input[name='postal']").val(fakeAddress.postal);
+ $("input[name='region']").val(fakeAddress.region);
+ $("input[name='phone']").val(fakeAddress.phone);
- $('input[name="fullName"]').val(fakeAddress.fullName);
- $('input[name="address1"]').val(fakeAddress.address1);
- $('input[name="address2"]').val(fakeAddress.address2);
- $('input[name="city"]').val(fakeAddress.city);
- $('input[name="postal"]').val(fakeAddress.postal);
- $('input[name="region"]').val(fakeAddress.region);
- $('input[name="phone"]').val(fakeAddress.phone);
-
- $('#addressBookAddForm').submit();
- expect($('#addressBookAddForm')).toHandle("submit");
+ $("#addressBookAddForm").submit();
+ expect($("#addressBookAddForm")).toHandle("submit");
expect(ReactionCore.Collections.Cart.update).toHaveBeenCalled();
} else {
expect(cartWorkflow.workflow.indexOf("checkoutAddressBook")).toBeTruthy();
}
-
-
});
it("should select address for shipping", function () {
expect(Router.current().url).toEqual("/checkout");
- var thisStep = (cartWorkflow.status === "checkoutAddressBook");
- var thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutAddressBook");
+ let thisStep = cartWorkflow.status === "checkoutAddressBook";
+ let thisWorkflow = _.contains(cartWorkflow.workflow, "checkoutAddressBook");
if (thisStep && thisWorkflow) {
+ let primaryAddress = $(".list-group .address-ship-to:first-child");
- var primaryAddress = $('.list-group .address-ship-to:first-child');
+ $(".list-group .address-ship-to:first-child").trigger("click");
- $('.list-group .address-ship-to:first-child').trigger('click');
-
- expect($(primaryAddress)).toHaveBeenTriggeredOn('click');
- expect($('.address-ship-to .list-group-item .active')).toExist();
+ expect($(primaryAddress)).toHaveBeenTriggeredOn("click");
+ expect($(".address-ship-to .list-group-item .active")).toExist();
expect(ReactionCore.Collections.Cart.update).toHaveBeenCalled();
-
} else {
-
expect(cartWorkflow.workflow).not.toContain("checkoutAddressBook");
}
-
});
-
});
-
describe("coreCheckoutShipping", function () {
it("should select Standard shipping method", function () {
- var thisStep = (cartWorkflow.status === "coreCheckoutShipping");
- var thisWorkflow = _.contains(cartWorkflow.workflow, "coreCheckoutShipping");
+ let thisStep = cartWorkflow.status === "coreCheckoutShipping";
+ let thisWorkflow = _.contains(cartWorkflow.workflow, "coreCheckoutShipping");
if (thisStep || thisWorkflow) {
- var standardShipping = $('.checkout-shipping .list-group-item:nth-child(2)');
+ let standardShipping = $(".checkout-shipping .list-group-item:nth-child(2)");
- $('.checkout-shipping .list-group-item:nth-child(2)').trigger('click');
+ $(".checkout-shipping .list-group-item:nth-child(2)").trigger("click");
- expect(standardShipping).toHandle('click');
+ expect(standardShipping).toHandle("click");
expect(ReactionCore.Collections.Cart.update).toHaveBeenCalled();
} else {
expect(cartWorkflow.workflow).not.toContain("coreCheckoutShipping");
}
});
-
});
});
diff --git a/tests/jasmine/client/integration/productSpecs.js b/tests/jasmine/client/integration/productSpecs.js
index cf241266f93..2532cd4487d 100644
--- a/tests/jasmine/client/integration/productSpecs.js
+++ b/tests/jasmine/client/integration/productSpecs.js
@@ -14,7 +14,7 @@ describe("Product", function() {
spyOn(Roles, "userIsInRole").and.returnValue(false);
spyOn(Products, "insert");
- Meteor.call("createProduct", function(error, result) {
+ Meteor.call("products/createProduct", function(error, result) {
expect(error.error).toEqual(403);
});