Sha256: db4970133ad2d6e91889b467d9061b2ba09b7f414e76238839f43c8f5db59cf3
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
import { ENV } from '@ember/-internals/environment'; import { underscore } from '@ember/string'; import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; function test(assert, given, expected, description) { assert.deepEqual(underscore(given), expected, description); if (ENV.EXTEND_PROTOTYPES.String) { assert.deepEqual(given.underscore(), expected, description); } } moduleFor( 'EmberStringUtils.underscore', class extends AbstractTestCase { ['@test String.prototype.underscore is not available without EXTEND_PROTOTYPES'](assert) { if (!ENV.EXTEND_PROTOTYPES.String) { assert.ok( 'undefined' === typeof String.prototype.underscore, 'String.prototype helper disabled' ); } else { assert.expect(0); } } ['@test String underscore tests'](assert) { test(assert, 'my favorite items', 'my_favorite_items', 'with normal string'); test(assert, 'css-class-name', 'css_class_name', 'with dasherized string'); test(assert, 'action_name', 'action_name', 'does nothing with underscored string'); test(assert, 'innerHTML', 'inner_html', 'with camelcased string'); test( assert, 'PrivateDocs/OwnerInvoice', 'private_docs/owner_invoice', 'underscore namespaced classified string' ); test( assert, 'privateDocs/ownerInvoice', 'private_docs/owner_invoice', 'underscore namespaced camelized string' ); test( assert, 'private-docs/owner-invoice', 'private_docs/owner_invoice', 'underscore namespaced dasherized string' ); } } );
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.6.0.0 | dist/es/@ember/string/tests/underscore_test.js |