Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
764f0684
Commit
764f0684
authored
Apr 25, 2016
by
Ahsan Ulhaq
Committed by
Clinton Blackburn
May 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add js test for analytics event on LMS receipt page
ECOM-4281
parent
a7488533
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
2 deletions
+125
-2
lms/static/js/fixtures/commerce/checkout_receipt.html
+26
-0
lms/static/js/spec/commerce/receipt_spec.js
+90
-0
lms/static/js/spec/main.js
+7
-1
lms/static/karma_lms.conf.js
+2
-1
No files found.
lms/static/js/fixtures/commerce/checkout_receipt.html
0 → 100644
View file @
764f0684
<div
id=
"error-container"
class=
"hidden"
>
<div
id=
"error"
class=
"wrapper-msg wrapper-msg-activate"
>
<div
class=
" msg msg-activate"
>
<span
class=
"msg-icon icon fa fa-exclamation-triangle"
aria-hidden=
"true"
></span>
<div
class=
"msg-content"
>
<h3
class=
"title"
>
Error
</h3>
<div
class=
"copy"
>
<p>
dummy error text
</p>
</div>
</div>
</div>
</div>
</div>
<div
class=
"container"
>
<section
class=
"wrapper carousel"
>
<div
id=
"receipt-container"
class=
"pay-and-verify hidden"
data-is-payment-complete=
'True'
data-platform-name=
'edx-platform'
data-verified=
'True'
data-username=
'user-1'
>
<h2>
${_("Loading Order Data...")}
</h2>
<span>
${ _("Please wait while we retrieve your order details.") }
</span>
</div>
</section>
</div>
lms/static/js/spec/commerce/receipt_spec.js
0 → 100644
View file @
764f0684
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
(
"<script id=
\"
receipt-tpl
\"
type=
\"
text/template
\"
>"
+
receiptFixture
+
"</script>"
);
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"
}
);
});
});
}
);
lms/static/js/spec/main.js
View file @
764f0684
...
...
@@ -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
++
)
{
...
...
lms/static/karma_lms.conf.js
View file @
764f0684
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment