Files
dashtab/tests/integration/components/wallpaper-credit-test.gjs
raucao 6750c61d87 Add Nostr photo feeds and wallpaper selection
Read the curated photo feeds from wss://nostr.kosmos.org, verify events, cache originals and thumbnails, and let users pick a wallpaper from the Photos section. Nature is the default feed; City Nights is opt-in. Adds the manual publishing scripts, real event fixtures, protocol documentation, and tests with stubbed network connections.
2026-11-08 21:51:23 +04:00

48 lines
1.5 KiB
Plaintext

import { module, test } from 'qunit';
import { setupRenderingTest } from 'dashtab/tests/helpers';
import { render } from '@ember/test-helpers';
import WallpaperCredit from 'dashtab/components/wallpaper-credit';
import FakePhotos from 'dashtab/tests/helpers/fake-photos';
module('Integration | Component | wallpaper-credit', function (hooks) {
setupRenderingTest(hooks);
function registerPhotos(context, currentCredit) {
const photos = new FakePhotos();
photos.currentCredit = currentCredit;
context.owner.register('service:photos', photos, {
instantiate: false,
});
return photos;
}
test('links the credit to the creator profile', async function (assert) {
registerPhotos(this, {
name: 'Adrian Infernus',
url: 'https://unsplash.com/@adrian_infernus',
platform: 'unsplash',
});
await render(<template><WallpaperCredit /></template>);
assert
.dom('[data-test-wallpaper-credit]')
.hasText('Photo by Adrian Infernus');
assert
.dom('[data-test-wallpaper-credit]')
.hasAttribute('href', 'https://unsplash.com/@adrian_infernus');
assert.dom('[data-test-wallpaper-credit]').hasAttribute('target', '_blank');
assert
.dom('[data-test-wallpaper-credit]')
.hasAttribute('rel', 'noopener noreferrer');
});
test('does not render without creator data', async function (assert) {
registerPhotos(this, null);
await render(<template><WallpaperCredit /></template>);
assert.dom('[data-test-wallpaper-credit]').doesNotExist();
});
});