diff --git a/lms/static/js/fixtures/commerce/checkout_receipt.html b/lms/static/js/fixtures/commerce/checkout_receipt.html
new file mode 100644
index 0000000000..3ac46d62b9
--- /dev/null
+++ b/lms/static/js/fixtures/commerce/checkout_receipt.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
${_("Loading Order Data...")}
+ ${ _("Please wait while we retrieve your order details.") }
+
+
+
diff --git a/lms/static/js/spec/commerce/receipt_spec.js b/lms/static/js/spec/commerce/receipt_spec.js
new file mode 100644
index 0000000000..79e5b92771
--- /dev/null
+++ b/lms/static/js/spec/commerce/receipt_spec.js
@@ -0,0 +1,90 @@
+define([
+ 'js/commerce/views/receipt_view'
+ ],
+ function (){
+ 'use strict';
+ describe("edx.commerce.ReceiptView", function(ReceiptView) {
+ var view, data = null;
+
+ beforeEach(function(){
+ loadFixtures("js/fixtures/commerce/checkout_receipt.html");
+
+ var receiptFixture = readFixtures("templates/commerce/receipt.underscore");
+ appendSetFixtures(
+ ""
+ );
+ data = {
+ "status": "Open",
+ "billed_to": {
+ "city": "dummy city",
+ "first_name": "john",
+ "last_name": "doe",
+ "country": "AL",
+ "line2": "line2",
+ "line1": "line1",
+ "state": "",
+ "postcode": "12345"
+ },
+ "lines": [
+ {
+ "status": "Open",
+ "unit_price_excl_tax": "10.00",
+ "product": {
+ "attribute_values": [
+ {
+ "name": "certificate_type",
+ "value": "verified"
+ },
+ {
+ "name": "course_key",
+ "value": "course-v1:edx+dummy+2015_T3"
+ }
+ ],
+ "stockrecords": [
+ {
+ "price_currency": "USD",
+ "product": 123,
+ "partner_sku": "1234ABC",
+ "partner": 1,
+ "price_excl_tax": "10.00",
+ "id": 123
+ }
+ ],
+ "product_class": "Seat",
+ "title": "Dummy title",
+ "url": "https://ecom.edx.org/api/v2/products/123/",
+ "price": "10.00",
+ "expires": null,
+ "is_available_to_buy": true,
+ "id": 123,
+ "structure": "child"
+ },
+ "line_price_excl_tax": "10.00",
+ "description": "dummy description",
+ "title": "dummy title",
+ "quantity": 1
+ }
+ ],
+ "number": "EDX-123456",
+ "date_placed": "2016-01-01T01:01:01Z",
+ "currency": "USD",
+ "total_excl_tax": "10.00"
+ };
+ view = new ReceiptView({el: $('#receipt-container')});
+ view.renderReceipt(data);
+ });
+ it("sends analytic event when receipt is rendered", function() {
+ expect(window.analytics.track).toHaveBeenCalledWith(
+ "Completed Order",
+ {
+ orderId: "EDX-123456",
+ total: "10.00",
+ currency: "USD"
+ }
+ );
+
+ });
+
+ });
+ }
+);
diff --git a/lms/static/js/spec/main.js b/lms/static/js/spec/main.js
index b8942877cd..9d1b3698c9 100644
--- a/lms/static/js/spec/main.js
+++ b/lms/static/js/spec/main.js
@@ -98,6 +98,7 @@
'js/bookmarks/views/bookmarks_list': 'js/bookmarks/views/bookmarks_list',
'js/bookmarks/views/bookmark_button': 'js/bookmarks/views/bookmark_button',
'js/views/message_banner': 'js/views/message_banner',
+ 'js/commerce/views/receipt_view': 'js/commerce/views/receipt_view',
// edxnotes
'annotator_1.2.9': 'xmodule_js/common_static/js/vendor/edxnotes/annotator-full.min',
@@ -317,6 +318,10 @@
exports: 'js/ccx/schedule',
deps: ['jquery', 'underscore', 'backbone', 'gettext', 'moment']
},
+ 'js/commerce/views/receipt_view': {
+ exports: 'edx.commerce.ReceiptView',
+ deps: ['jquery', 'backbone', 'underscore', 'underscore.string']
+ },
// Backbone classes loaded explicitly until they are converted to use RequireJS
'js/instructor_dashboard/ecommerce': {
@@ -763,7 +768,8 @@
'js/spec/learner_dashboard/collection_list_view_spec.js',
'js/spec/learner_dashboard/sidebar_view_spec.js',
'js/spec/learner_dashboard/program_card_view_spec.js',
- 'js/spec/learner_dashboard/certificate_view_spec.js'
+ 'js/spec/learner_dashboard/certificate_view_spec.js',
+ 'js/spec/commerce/receipt_spec.js'
];
for (var i = 0; i < testFiles.length; i++) {
diff --git a/lms/static/karma_lms.conf.js b/lms/static/karma_lms.conf.js
index 069789799f..6da66ac7e2 100644
--- a/lms/static/karma_lms.conf.js
+++ b/lms/static/karma_lms.conf.js
@@ -117,7 +117,8 @@ var fixtureFiles = [
{pattern: 'support/templates/**/*.*', included: false},
{pattern: 'templates/bookmarks/**/*.*', included: false},
{pattern: 'templates/learner_dashboard/**/*.*', included: false},
- {pattern: 'templates/ccx/**/*.*', included: false}
+ {pattern: 'templates/ccx/**/*.*', included: false},
+ {pattern: 'templates/commerce/receipt.underscore', included: false}
];
// override fixture path and other config.