-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
122 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!doctype html> | ||
<!-- | ||
@license | ||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<script src="../../../web-component-tester/browser.js"></script> | ||
<link rel="import" href="../../src/polymer-lib.html"> | ||
<link rel="import" href="../../src/lib/case-map.html"> | ||
</head> | ||
<body> | ||
|
||
<script> | ||
suite('case-map', function() { | ||
var caseMap; | ||
|
||
setup(function() { | ||
caseMap = Polymer.CaseMap; | ||
}); | ||
|
||
test('camelToDashCase converts to dashes', function() { | ||
assert.equal(caseMap.camelToDashCase('camelCase'), 'camel-case'); | ||
assert.equal(caseMap.camelToDashCase('camelCCase'), 'camel-c-case'); | ||
}); | ||
|
||
test('camelToDashCase caches conversions', function() { | ||
caseMap._caseMap['camelCase'] = 'some-other-camel-case'; | ||
assert.equal(caseMap.camelToDashCase('camelCase'), 'some-other-camel-case'); | ||
|
||
var result = caseMap.camelToDashCase('camelCCase'); | ||
assert.equal(Polymer.CaseMap._caseMap['camelCCase'], result); | ||
}); | ||
|
||
test('dashToCamelCase converts to camelCase', function() { | ||
assert.equal(caseMap.dashToCamelCase('camel-case'), 'camelCase'); | ||
assert.equal(caseMap.dashToCamelCase('camel-c-case'), 'camelCCase'); | ||
}); | ||
|
||
test('dashToCamelCase caches conversions', function() { | ||
caseMap._caseMap['camel-case'] = 'someOtherCamelCase'; | ||
assert.equal(caseMap.dashToCamelCase('camel-case'), 'someOtherCamelCase'); | ||
|
||
var result = caseMap.dashToCamelCase('camel-c-case'); | ||
assert.equal(Polymer.CaseMap._caseMap['camel-c-case'], result); | ||
}); | ||
|
||
test('camelToDashCase and dashToCamelCase reverse the other function', function() { | ||
var camelCase = caseMap.dashToCamelCase('camel-c-case'); | ||
assert.equal(caseMap.camelToDashCase(camelCase), 'camel-c-case'); | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters