Sha256: e0995ea74e757ffbf41e2b46557ddbba42a5288043c42b32000c516dec73dfa0
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
import { ENV } from 'ember-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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.5.1.1 | dist/es/@ember/string/tests/underscore_test.js |
discourse-ember-source-3.5.1.0 | dist/dist/es/@ember/string/tests/underscore_test.js |