Refactor lyric storage so each song owns its sections instead of sharing global labels. Adds song_sections (per song+label) owning song_slides; labels stay global ProPresenter group tags (name/color/macro). Arrangements now reference sections, so editing/importing one song no longer corrupts others that share a label name. - New: song_sections table + migration with safe backfill; SongSection, SongArrangementSection models; SongSectionController (edit/add/delete sections, immediate persistence) wired into SongEditModal. - Refactor writers/readers: CcliImport, ProImport, SongService, ArrangementController, SongController, ProExport, PDF, Translation (translation reset now section-scoped), CCLI pairing. - CCLI import fixes: parse SongSelect copy-icon format (German "Vers" abbrev + trailing author), fill empty CTS-synced songs instead of blocking as duplicate, distinct label colors per section kind, import&edit/existing-song open the edit modal (no 404/405), teleport paste dialog above assign dialog, preview shows section content, correct SongSelect search URL, copy-icon instructions. - Bookmarklet clicks #generalCopyLyricsButton and captures clipboard; serves correct host from request. - Export: embed key-visual/background under fixed bundle-relative names. - Tests updated for the section model; new section + isolation coverage.
66 lines
2.1 KiB
PHP
66 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
final class BookmarkletControllerTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_bookmarklet_endpoint_returns_200_with_text_javascript_content_type(): void
|
|
{
|
|
$response = $this->get('/bookmarklets/ccli-import.js');
|
|
|
|
$response->assertStatus(200);
|
|
$response->assertHeader('Content-Type', 'text/javascript; charset=utf-8');
|
|
}
|
|
|
|
public function test_bookmarklet_response_starts_with_javascript_prefix(): void
|
|
{
|
|
$response = $this->get('/bookmarklets/ccli-import.js');
|
|
|
|
expect($response->getContent())->toStartWith('javascript:');
|
|
}
|
|
|
|
public function test_bookmarklet_response_is_a_single_line_with_no_actual_newlines(): void
|
|
{
|
|
$response = $this->get('/bookmarklets/ccli-import.js');
|
|
$content = (string) $response->getContent();
|
|
|
|
expect(substr_count($content, "\n"))->toBe(0);
|
|
}
|
|
|
|
public function test_bookmarklet_response_contains_app_url_and_import_path(): void
|
|
{
|
|
$response = $this->get('/bookmarklets/ccli-import.js');
|
|
$content = $response->getContent();
|
|
|
|
expect($content)->toContain('import-from-ccli-paste');
|
|
expect($content)->toContain('songselect.ccli.com');
|
|
expect($content)->toContain('btoa');
|
|
}
|
|
|
|
public function test_bookmarklet_response_uses_request_host_instead_of_configured_app_url(): void
|
|
{
|
|
config(['app.url' => 'http://pp-planer.test']);
|
|
|
|
$response = $this
|
|
->withServerVariables(['HTTP_HOST' => 'pp-planer.ddev.site', 'HTTPS' => 'on'])
|
|
->get('/bookmarklets/ccli-import.js');
|
|
$content = $response->getContent();
|
|
|
|
expect($content)->toContain('pp-planer.ddev.site')
|
|
->not->toContain('pp-planer.test');
|
|
}
|
|
|
|
public function test_bookmarklet_endpoint_does_not_require_authentication(): void
|
|
{
|
|
$response = $this->get('/bookmarklets/ccli-import.js');
|
|
|
|
$response->assertStatus(200);
|
|
$response->assertHeader('Content-Type', 'text/javascript; charset=utf-8');
|
|
}
|
|
}
|