Skip to content

Commit

Permalink
🐛 Fix svg color not detected if preceded with >
Browse files Browse the repository at this point in the history
Fixes abe33#162
  • Loading branch information
abe33 committed Mar 22, 2016
1 parent 323ec2b commit 941fc7a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/regexes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ decimal = "\\.#{int}"
float = "(?:#{int}#{decimal}|#{int}|#{decimal})"
percent = "#{float}%"
variables = '(?:@[a-zA-Z0-9\\-_]+|\\$[a-zA-Z0-9\\-_]+|[a-zA-Z_][a-zA-Z0-9\\-_]*)'
namePrefixes = '^| |\\t|:|=|,|\\n|\'|"|\\(|\\[|\\{'
namePrefixes = '^| |\\t|:|=|,|\\n|\'|"|\\(|\\[|\\{|>'

module.exports =
int: int
Expand Down
1 change: 1 addition & 0 deletions spec/color-parser-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ describe 'ColorParser', ->
itParses('YellowGreen').asColor('#9acd32')
itParses('yellow_green').asColor('#9acd32')
itParses('YELLOW_GREEN').asColor('#9acd32')
itParses('>YELLOW_GREEN').asColor('#9acd32')

itParses('darken(cyan, 20%)').asColor(0, 153, 153)
itParses('darken(cyan, 20)').asColor(0, 153, 153)
Expand Down
9 changes: 9 additions & 0 deletions spec/color-scanner-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,12 @@ describe 'ColorScanner', ->
doSearch()

expect(result.color).toBeDefined()

withScannerForTextEditor 'color-in-tag-content.html', ->
it 'finds both colors', ->
result = lastIndex: 0
doSearch = -> result = scanner.search(text, 'html', result.lastIndex)

expect(doSearch()).toBeDefined()
expect(doSearch()).toBeDefined()
expect(doSearch()).toBeUndefined()
1 change: 1 addition & 0 deletions spec/fixtures/color-in-tag-content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div>Blue White</div>

0 comments on commit 941fc7a

Please sign in to comment.