Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Autolink URLs in story description #220

Open
wants to merge 4 commits into from

1 participant

@marnen

image
image

I'm having a similar problem here to the one I mentioned in #219: spec/features/stories_spec.rb:153 succeeds when run by itself, but fails otherwise.

@marnen

Hmm, I see the build failed. Let me see what I can do about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 2, 2014
  1. @marnen

    Autolink URLs.

    marnen authored
  2. @marnen

    Make specs more reliable.

    marnen authored
Commits on Mar 3, 2014
  1. @marnen
  2. @marnen
This page is out of date. Refresh to see the latest.
View
2  app/assets/javascripts/templates/story_hover.jst.ejs
@@ -16,7 +16,7 @@
</div>
<% if (story.get('description')) { %>
<h4 class="title"><%= story.humanAttributeName('description') %></h4>
- <div class="description"><%= window.md.makeHtml(story.escape('description')) %></div>
+ <div class="description"><%= window.md.makeHtml(story.get('description')) %></div>
<% } %>
<% if (story.hasNotes()) { %>
<h5 class="title"><%= I18n.t('notes') %></h5>
View
2  app/assets/javascripts/views/story_view.js
@@ -346,7 +346,7 @@ Fulcrum.StoryView = Fulcrum.FormView.extend({
var description = this.make('div');
$(description).addClass('description');
$(description).html(
- window.md.makeHtml(this.model.escape('description'))
+ window.md.makeHtml(this.model.get('description') || "")
);
$(div).append(description);
$(description).after(
View
48 spec/features/stories_spec.rb
@@ -118,6 +118,54 @@
end
end
+ describe 'formatting' do
+ let(:title) { 'My story' }
+ let!(:story) { FactoryGirl.create :story, title: title, description: description, project: project, requested_by: user }
+
+ before do
+ Capybara.ignore_hidden_elements = true
+ visit project_path project
+ end
+
+ describe 'description', js: true do
+ let(:expand_story) { find('.story-title', text: title).click }
+ let(:hover_story) { find('.popover-activate').hover }
+
+ describe '*italics*' do
+ let(:description) { 'Text with *italics*.' }
+
+ specify 'edit form' do
+ expand_story
+ page.should have_css :em, text: 'italics'
+ end
+ end
+
+ describe 'autolink URLs' do
+ let(:url) { 'http://www.google.com' }
+ let(:description) { "Text with a URL: #{url}" }
+
+ specify 'edit form' do
+ expand_story
+ page.should have_css "a[href='#{url}']", text: url
+ end
+
+ specify 'hover' do
+ hover_story
+ page.should have_css "a[href='#{url}']", text: url
+ end
+ end
+
+ describe 'handle blank correctly' do
+ let(:description) { nil }
+
+ specify 'edit form' do
+ expand_story
+ page.should have_css '.description'
+ end
+ end
+ end
+ end
+
def story_selector(story)
"#story-#{story.id}"
end
Something went wrong with that request. Please try again.