summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authormo k <mo@mokhan.ca>2012-09-18 16:55:43 -0600
committermo k <mo@mokhan.ca>2012-09-18 16:55:43 -0600
commit1c526417be85ccd28e513fba9142ed1184818ac6 (patch)
tree3f550fb5d8aa136f4967f772fe1b659570bbb6d3 /spec/javascripts
parent76db9fbf337b8b774e069021c682b3e2e6439eec (diff)
update the preview when url info is received.
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/presenters/new_tutorial_presenter_spec.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/spec/javascripts/presenters/new_tutorial_presenter_spec.js b/spec/javascripts/presenters/new_tutorial_presenter_spec.js
index a74c4ec1..3b8bb836 100644
--- a/spec/javascripts/presenters/new_tutorial_presenter_spec.js
+++ b/spec/javascripts/presenters/new_tutorial_presenter_spec.js
@@ -5,7 +5,13 @@ describe ("NewTutorialPresenter", function() {
tag_list: $('<ul id="tag-list">'),
tag_input: $('<input type="text" />'),
hidden_tag_list: $('<input type="hidden" />'),
- url_input: $('<input type="text" />')
+ url_input: $('<input type="text" />'),
+ preview: {
+ heading: $('<h3>'),
+ description: $('<p>'),
+ image: $('<img>'),
+ hidden_image_url: $('<input type="hidden">'),
+ }
};
service = {
retrieve_info_on:null
@@ -54,4 +60,26 @@ describe ("NewTutorialPresenter", function() {
});
var url;
});
+ describe ("when information is received about a url", function() {
+ it ("should update the preview heading", function() {
+ expect(view.preview.heading.text()).toEqual('the title');
+ });
+ it ("should update the preview description", function() {
+ expect(view.preview.description.text()).toEqual('the description');
+ });
+ it ("should update the preview image", function() {
+ expect(view.preview.image.attr('src')).toEqual('http://');
+ });
+ it ("should update the hidden input image url", function() {
+ expect(view.preview.hidden_image_url.val()).toEqual('http://');
+ });
+ beforeEach (function() {
+ var payload = {
+ title: 'the title',
+ description: 'the description',
+ thumbnail_url: 'http://'
+ };
+ sut.display_url_info(payload);
+ });
+ });
});