2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2020-02-20 18:53:37 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
|
|
import { render } from '@ember/test-helpers';
|
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
|
2022-09-15 08:43:17 +00:00
|
|
|
module('Integration | Helper | substr', function (hooks) {
|
2020-02-20 18:53:37 +00:00
|
|
|
setupRenderingTest(hooks);
|
|
|
|
|
|
|
|
// Replace this with your real tests.
|
2022-09-15 08:43:17 +00:00
|
|
|
test('it returns last 2 characters of string', async function (assert) {
|
2020-02-20 18:53:37 +00:00
|
|
|
this.set('inputValue', 'd9a54409-648b-4327-974f-62a45c8c65f1');
|
|
|
|
|
|
|
|
await render(hbs`{{substr inputValue -4}}`);
|
|
|
|
|
2020-02-21 16:48:54 +00:00
|
|
|
assert.equal(this.element.textContent.trim(), '65f1');
|
2020-02-20 18:53:37 +00:00
|
|
|
});
|
|
|
|
});
|