# frozen_string_literal: true

require 'rails_helper'

describe Demo::Component, type: :view_component do
  let(:options) { {} }
  let(:component) { Demo::Component.new(**options) }

  subject { page }

  describe 'previews' do
    it 'renders' do
      render_preview(:default)

      is_expected.to have_css 'div'
      is_expected.to have_css 'p'
      is_expected.to have_css 'button'
    end

    context 'with missing translations' do
      it 'does not crash' do
        render_preview(:with_missing_translation)

        is_expected.to have_text 'Missing'
      end
    end
  end
end
