Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove @ from none key #68

Merged
merged 2 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/iiif_manifest/v3/manifest_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def valid_language_map?(obj)

def obj_to_language_map(obj)
return nil unless obj.is_a?(String) || (obj.is_a?(Array) && obj.all? { |o| o.is_a?(String) })
{ '@none' => Array(obj) }
{ 'none' => Array(obj) }
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
expect(annotation.body['height']).to eq 480
expect(annotation.body['format']).to eq 'image/jpeg'
expect(annotation.body['duration']).to be_nil
expect(annotation.body['label']).to eq('@none' => ['full'])
expect(annotation.body['label']).to eq('none' => ['full'])
end
end

Expand All @@ -99,7 +99,7 @@
expect(annotation.body['type']).to eq 'Audio'
expect(annotation.body['duration']).to eq 1000
expect(annotation.body['format']).to eq 'audio/aac'
expect(annotation.body['label']).to eq('@none' => ['Track 1'])
expect(annotation.body['label']).to eq('none' => ['Track 1'])
expect(annotation.body['width']).to be_nil
expect(annotation.body['height']).to be_nil
end
Expand All @@ -123,7 +123,7 @@
expect(annotation.body['width']).to eq 640
expect(annotation.body['height']).to eq 480
expect(annotation.body['duration']).to eq 1000
expect(annotation.body['label']).to eq('@none' => ['Reel 1'])
expect(annotation.body['label']).to eq('none' => ['Reel 1'])
expect(annotation.body['format']).to eq 'video/mp4'
end
end
Expand Down Expand Up @@ -173,7 +173,7 @@
expect(annotation.body['width']).to eq 640
expect(annotation.body['height']).to eq 480
expect(annotation.body['duration']).to eq 1000
expect(annotation.body['label']).to eq('@none' => ['Reel 1'])
expect(annotation.body['label']).to eq('none' => ['Reel 1'])
expect(annotation.body['format']).to eq 'video/mp4'
expect(annotation.body['service']).to include auth_service
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
describe '#new' do
it 'builds a canvas with a label' do
allow(record).to receive(:to_s).and_return('Test Canvas')
expect(builder.canvas.label).to eq('@none' => ['Test Canvas'])
expect(builder.canvas.label).to eq('none' => ['Test Canvas'])
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def initialize(label:, ranges: [], file_set_presenters: [])
it 'builds the structure' do
subject
top_range = manifest['structures'].first
expect(top_range['label']).to eq('@none' => ['Table of Contents'])
expect(top_range['label']).to eq('none' => ['Table of Contents'])
expect(top_range['behavior']).to eq 'top'
expect(top_range['items'].length).to eq 2
expect(top_range['items'][0]['type']).to eq 'Canvas'
expect(top_range['items'][0]['id']).to eq 'http://test.host/books/book-77/manifest/canvas/Front-Cover'
sub_range = top_range['items'][1]
expect(sub_range['type']).to eq 'Range'
expect(sub_range['label']).to eq('@none' => ['Chapter 1'])
expect(sub_range['label']).to eq('none' => ['Chapter 1'])
expect(sub_range['items'].length).to eq 2
expect(sub_range['items'][0]['type']).to eq 'Canvas'
expect(sub_range['items'][0]['id']).to eq 'http://test.host/books/book-77/manifest/canvas/Page-1'
Expand Down Expand Up @@ -99,7 +99,7 @@ def initialize(label:, items: [])
it 'builds the structure' do
subject
top_range = manifest['structures'].first
expect(top_range['label']).to eq('@none' => ['Table of Contents'])
expect(top_range['label']).to eq('none' => ['Table of Contents'])
expect(top_range['behavior']).to eq 'top'
expect(top_range['items'].length).to eq 3
expect(top_range['items'][0]['type']).to eq 'Canvas'
Expand All @@ -119,9 +119,9 @@ def initialize(label:, items: [])
context 'with language maps' do
let(:ranges) do
[
ManifestRange.new(label: { '@none' => ['Table of Contents'] }, items: [
ManifestRange.new(label: { 'none' => ['Table of Contents'] }, items: [
double(id: 'Front-Cover'),
ManifestRange.new(label: { '@none' => ['Chapter 1'] }, items: [
ManifestRange.new(label: { 'none' => ['Chapter 1'] }, items: [
double(id: 'Page-1'),
double(id: 'Page-2')
]),
Expand Down Expand Up @@ -152,14 +152,14 @@ def initialize(label: nil, items: [])
it 'builds the structure' do
subject
top_range = manifest['structures'].first
expect(top_range['label']).to eq('@none' => ['Table of Contents'])
expect(top_range['label']).to eq('none' => ['Table of Contents'])
expect(top_range['behavior']).to eq 'top'
expect(top_range['items'].length).to eq 4
expect(top_range['items'][0]['type']).to eq 'Canvas'
expect(top_range['items'][0]['id']).to eq 'http://test.host/books/book-77/manifest/canvas/Front-Cover'
sub_range = top_range['items'][1]
expect(sub_range['type']).to eq 'Range'
expect(sub_range['label']).to eq('@none' => ['Chapter 1'])
expect(sub_range['label']).to eq('none' => ['Chapter 1'])
expect(sub_range['items'].length).to eq 2
expect(sub_range['items'][0]['type']).to eq 'Canvas'
expect(sub_range['items'][0]['id']).to eq 'http://test.host/books/book-77/manifest/canvas/Page-1'
Expand Down
22 changes: 11 additions & 11 deletions spec/lib/iiif_manifest/v3/manifest_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ def display_content
let(:json_result) { JSON.parse(subject.to_h.to_json) }

it 'has a label' do
expect(result.label).to eq('@none' => ['A good book'])
expect(result.label).to eq('none' => ['A good book'])
end

it 'has a summary' do
expect(result.summary).to eq('@none' => ['a brief description'])
expect(result.summary).to eq('none' => ['a brief description'])
end

context 'has a summary' do
Expand Down Expand Up @@ -157,7 +157,7 @@ def display_content

expect(result['structures'].length).to eq 1
structure = result['structures'].first
expect(structure['label']).to eq('@none' => ['Table of Contents'])
expect(structure['label']).to eq('none' => ['Table of Contents'])
expect(structure['behavior']).to eq 'top'
expect(structure['items'].length).to eq 1
sub_range = structure['items'][0]
Expand Down Expand Up @@ -249,7 +249,7 @@ def sequence_rendering
expect(result['rendering']).to eq [{
'id' => 'http://test.host/file_set/id/download',
'format' => 'application/pdf',
'label' => { '@none' => ['Download'] }
'label' => { 'none' => ['Download'] }
}]
end
end
Expand Down Expand Up @@ -278,8 +278,8 @@ def sequence_rendering

it 'has metadata' do
allow(book_presenter).to receive(:manifest_metadata).and_return(metadata)
expect(result['metadata'][0]['label']).to eq('@none' => ['Title'])
expect(result['metadata'][0]['value']).to eq('@none' => ['Title of the Item'])
expect(result['metadata'][0]['label']).to eq('none' => ['Title'])
expect(result['metadata'][0]['value']).to eq('none' => ['Title of the Item'])
end
end

Expand Down Expand Up @@ -361,7 +361,7 @@ def sequence_rendering
end
it 'returns a IIIF Collection' do
expect(result['type']).to eq 'Collection'
expect(result['label']).to eq('@none' => ['A good book'])
expect(result['label']).to eq('none' => ['A good book'])
end
it "doesn't build sequences" do
expect(result['sequences']).to eq nil
Expand All @@ -374,7 +374,7 @@ def sequence_rendering
first_child = result['manifests'].first
expect(first_child['id']).to eq 'http://test.host/books/test2/manifest'
expect(first_child['type']).to eq 'Manifest'
expect(first_child['label']).to eq('@none' => ['Inner book'])
expect(first_child['label']).to eq('none' => ['Inner book'])
end
end

Expand Down Expand Up @@ -505,7 +505,7 @@ def display_content
expect(content_annotation_body['width']).to eq 100
expect(content_annotation_body['format']).to eq 'video/mp4'
expect(content_annotation_body['duration']).to eq 100
expect(content_annotation_body['label']).to eq('@none' => ['High'])
expect(content_annotation_body['label']).to eq('none' => ['High'])
end

context 'with audio file' do
Expand All @@ -523,7 +523,7 @@ def display_content
expect(content_annotation_body.key?('width')).to eq false
expect(content_annotation_body['format']).to eq 'audio/mp4'
expect(content_annotation_body['duration']).to eq 100
expect(content_annotation_body['label']).to eq('@none' => ['High'])
expect(content_annotation_body['label']).to eq('none' => ['High'])
end
end
end
Expand Down Expand Up @@ -561,7 +561,7 @@ def display_content
expect(choice['height']).to eq 100
expect(choice['format']).to eq 'video/mp4'
expect(choice['duration']).to eq 100
expect(choice['label']['@none']).not_to be_empty
expect(choice['label']['none']).not_to be_empty
end
end
end
Expand Down