github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/tests/integration/helpers/trim-path-test.js (about) 1 import { module, test } from 'qunit'; 2 import { setupRenderingTest } from 'ember-qunit'; 3 import { render } from '@ember/test-helpers'; 4 import { hbs } from 'ember-cli-htmlbars'; 5 6 module('Integration | Helper | trim-path', function (hooks) { 7 setupRenderingTest(hooks); 8 9 test('it doesnt mess with internal slashes', async function (assert) { 10 this.set('inputValue', 'a/b/c/d'); 11 await render(hbs`{{trim-path this.inputValue}}`); 12 assert.dom(this.element).hasText('a/b/c/d'); 13 }); 14 test('it will remove a prefix slash', async function (assert) { 15 this.set('inputValue', '/a/b/c/d'); 16 await render(hbs`{{trim-path this.inputValue}}`); 17 assert.dom(this.element).hasText('a/b/c/d'); 18 }); 19 test('it will remove a suffix slash', async function (assert) { 20 this.set('inputValue', 'a/b/c/d/'); 21 await render(hbs`{{trim-path this.inputValue}}`); 22 assert.dom(this.element).hasText('a/b/c/d'); 23 }); 24 test('it will remove both at once', async function (assert) { 25 this.set('inputValue', '/a/b/c/d/'); 26 await render(hbs`{{trim-path this.inputValue}}`); 27 assert.dom(this.element).hasText('a/b/c/d'); 28 }); 29 });