<!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>

Add unit test suite for CaseMap
Add unit test suite for CaseMap
