From c3cd5d33b1bc2eb335ac7e74b95f461f75f4b30c Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Mon, 25 Sep 2017 11:29:42 -0700 Subject: [PATCH] Use case insensitive checks when calculating score #6 --- lib/score.js | 3 +++ package.json | 2 +- test/resolve.js | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/score.js b/lib/score.js index 9a21672..f211a4a 100644 --- a/lib/score.js +++ b/lib/score.js @@ -10,6 +10,9 @@ const DASH = 45; // - * @return {Number} Match score */ export default function(abbr, string) { + abbr = abbr.toLowerCase(); + string = string.toLowerCase(); + if (abbr === string) { return 1; } diff --git a/package.json b/package.json index 89ea215..032196d 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "homepage": "https://github.com/emmetio/css-snippets-resolver#readme", "devDependencies": { - "@emmetio/css-abbreviation": "^0.2.1", + "@emmetio/css-abbreviation": "^0.3.1", "@emmetio/snippets-registry": "^0.3.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.22.0", "babel-register": "^6.22.0", diff --git a/test/resolve.js b/test/resolve.js index 88345a8..43f8c06 100644 --- a/test/resolve.js +++ b/test/resolve.js @@ -128,4 +128,8 @@ describe('CSS resolver', () => { it('snippets', () => { assert.equal(expand('@k'), '@keyframes ${1:identifier} {\n\t${2}\n}'); }); + + it('case insensitive matches', () => { + assert.equal(expand('trf:rx'), 'transform: rotateX(${1:angle});'); + }) });