Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4
@@ -94,3 +94,3 @@ lunr.QueryParser = function (str, query) { | ||
parser.currentClause.term = lexeme.str | ||
parser.currentClause.term = lexeme.str.toLowerCase() | ||
@@ -97,0 +97,0 @@ if (lexeme.str.indexOf("*") != -1) { |
{ | ||
"name": "lunr", | ||
"description": "Simple full-text search in your browser.", | ||
"version": "2.0.0-alpha.3", | ||
"version": "2.0.0-alpha.4", | ||
"author": "Oliver Nightingale", | ||
@@ -6,0 +6,0 @@ "keywords": ["search"], |
@@ -40,2 +40,30 @@ suite('lunr.QueryParser', function () { | ||
suite('single term, uppercase', function () { | ||
setup(function () { | ||
this.clauses = parse('FOO') | ||
}) | ||
test('has 1 clause', function () { | ||
assert.lengthOf(this.clauses, 1) | ||
}) | ||
suite('clauses', function () { | ||
setup(function () { | ||
this.clause = this.clauses[0] | ||
}) | ||
test('term', function () { | ||
assert.equal('foo', this.clause.term) | ||
}) | ||
test('fields', function () { | ||
assert.sameMembers(['title', 'body'], this.clause.fields) | ||
}) | ||
test('usePipeline', function () { | ||
assert.ok(this.clause.usePipeline) | ||
}) | ||
}) | ||
}) | ||
suite('single term with wildcard', function () { | ||
@@ -108,2 +136,27 @@ setup(function () { | ||
suite('uppercase field with uppercase term', function () { | ||
setup(function () { | ||
// Using a different query to the rest of the tests | ||
// so that only this test has to worry about an upcase field name | ||
var query = new lunr.Query (['TITLE']), | ||
parser = new lunr.QueryParser("TITLE:FOO", query) | ||
parser.parse() | ||
this.clauses = query.clauses | ||
}) | ||
test('has 1 clause', function () { | ||
assert.lengthOf(this.clauses, 1) | ||
}) | ||
test('clause contains downcased term', function () { | ||
assert.equal(this.clauses[0].term, 'foo') | ||
}) | ||
test('clause contains only scoped field', function () { | ||
assert.sameMembers(this.clauses[0].fields, ['TITLE']) | ||
}) | ||
}) | ||
suite('multiple terms scoped to different fields', function () { | ||
@@ -110,0 +163,0 @@ setup(function () { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2157855
24229