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.
48 lines
1.5 KiB
Plaintext
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();
|
|
});
|
|
});
|