mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3213 from TimvdLippe/fix-consecutive-uppercase-casemap
Add unit test suite for CaseMap
This commit is contained in:
commit
040787c048
60
test/unit/case-map.html
Normal file
60
test/unit/case-map.html
Normal file
@ -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>
|
Loading…
Reference in New Issue
Block a user