Skip to content

Commit

Permalink
Merge pull request #42 from kikihakiem/master
Browse files Browse the repository at this point in the history
Fix text node with space character issue
  • Loading branch information
searls committed Apr 24, 2015
2 parents 3c93cdd + c6b5abb commit 5694b50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/js/jasmine-fixture.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

create = (selectorOptions, attach) ->
$top=null
_(selectorOptions.split(/[ ](?=[^\]]*?(?:\[|$))/)).inject(($parent, elementSelector) ->
_(selectorOptions.split(/[ ](?![^\{]*\})(?=[^\]]*?(?:\[|$))/)).inject(($parent, elementSelector) ->
return $parent if elementSelector == ">"
$el = createHTMLBlock($,elementSelector)
$el.appendTo($parent) if attach || $top
Expand Down Expand Up @@ -289,7 +289,7 @@ createHTMLBlock = ( ->
regId = /(?:^|\b)#([\w-!]+)/i
regTagNotContent = /((([#\.]?[\w-]+)?(\[([\w!]+(="([^"]|\\")+")? {0,})+\])?)+)/i
###
See lookahead syntax (?!) at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
See lookahead syntax (?!) at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
###
regClasses = /(\.[\w-]+)(?!["\w])/g
regClass = /\.([\w-]+)/i
Expand Down
8 changes: 8 additions & 0 deletions spec/jasmine-fixture-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ describe "jasmine.fixture", ->
Given -> affix('a[data-target-pane="#pane-id"]')
Then -> expect($('body')).not.toHas('#pane-id')

context "text node with space char", ->
Given -> affix('a.link{Text With Space}')
Then -> expect($('.link').text()).toEqual('Text With Space')

describe ".create", ->
Given -> @subject = jasmine.fixture

Expand Down Expand Up @@ -72,3 +76,7 @@ describe "jasmine.fixture", ->
When -> @$result = @$container.affix('#content')
Then -> expect(@$container).toHas('#content')
And -> expect(@$result).toIs('#content')

context "text node with space char", ->
Given -> @result = @subject.create('a.link{Text With Space}')
Then -> @result.find('With').length == 0

0 comments on commit 5694b50

Please sign in to comment.