diff --git a/spec/rivets/binding.js b/spec/rivets/binding.js index 8278e5a81..027f0ab03 100644 --- a/spec/rivets/binding.js +++ b/spec/rivets/binding.js @@ -449,6 +449,21 @@ describe('Rivets.Binding', function() { binding.formattedValue('jacket').should.equal('arg | with || pipes totally jacket') }) }) + + describe('with a formatter string with quoted string arguments', function() { + beforeEach(function () { + + view.formatters.reverse = function (value, first, second) { + return second + ' ' + first + ' ' + value + } + + binding.formatters.push("reverse 'single quote' \"double quote\"") + }) + + it('applies the formatter with quoted string arguments', function () { + binding.formattedValue('jacket').should.equal('double quote single quote jacket') + }) + }) }) describe('getValue()', function() { diff --git a/src/bindings.coffee b/src/bindings.coffee index e3f34947d..fbb97cb68 100644 --- a/src/bindings.coffee +++ b/src/bindings.coffee @@ -63,7 +63,7 @@ class Rivets.Binding # formatted value. formattedValue: (value) => for formatter, fi in @formatters - args = formatter.match /[^\s']+|'([^']|'[^\s])*'|"([^"]|"[^\s])*"/g + args = formatter.match /[^\s'"]+|'([^']|'[^\s])*'|"([^"]|"[^\s])*"/g id = args.shift() formatter = @view.formatters[id]