From ffbdccb263b768e43a2d23cce80eae8b202f851e Mon Sep 17 00:00:00 2001 From: Torsten Date: Fri, 2 Dec 2022 18:28:58 +0200 Subject: [PATCH] fix style fields --- config/styles.yaml | 10 +++++----- spec/models/merged/style_spec.rb | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 spec/models/merged/style_spec.rb diff --git a/config/styles.yaml b/config/styles.yaml index 04c3f53..4e51a95 100644 --- a/config/styles.yaml +++ b/config/styles.yaml @@ -7,13 +7,13 @@ sections: cards: true fields: - header - text + - text - template: section_full_up header: Centered Header with text text: Full width header with centered headline and optional text fields: - header - text + - text - template: section_half_right header: Split section image right text: Image right, header and text on the left. Optional button. @@ -23,13 +23,13 @@ sections: Text is slightly shaded for readability fields: - header - text + - text - template: section_half_left header: Split section image left text: Image left, header and text on the right. Optional button. fields: - header - text + - text - template: section_spacer header: Spacer text: Just for extra padding @@ -40,4 +40,4 @@ cards: text: With text in bottom right corner, offset with solid color fields: - header - text + - text diff --git a/spec/models/merged/style_spec.rb b/spec/models/merged/style_spec.rb new file mode 100644 index 0000000..536d264 --- /dev/null +++ b/spec/models/merged/style_spec.rb @@ -0,0 +1,31 @@ +require 'rails_helper' + +module Merged + RSpec.describe Style, type: :model do + let(:first_section) {Style.sections.first} + let(:first_card) {Style.cards.first} + + it "has Style.sections" do + expect(Style.sections.class).to be Hash + expect(Style.sections.length).to be 6 + end + it "has Style.cards" do + expect(Style.cards.class).to be Hash + expect(Style.cards.length).to be 1 + end + it "Finds section by template" do + spacer = Style.sections["section_spacer"] + expect(spacer).not_to eq nil + end + it "Spacer has no fields" do + spacer = Style.sections["section_spacer"] + expect(spacer.fields).to be nil + end + it "2 col has fields" do + spacer = Style.sections["section_2_col"] + expect(spacer.fields.class).to be Array + expect(spacer.fields.length).to be 2 + end + + end +end