Sha256: f550426bc2f27b67c1c6c377429be2565a5acd7373cc7fc0bc947cc6ed992e41
Contents?: true
Size: 1.89 KB
Versions: 10
Compression:
Stored size: 1.89 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe CKEditor5::Rails::Editor::PropsBasePlugin do describe '.normalize' do it 'converts string to plugin instance' do plugin = described_class.normalize('Bold') expect(plugin).to be_a(described_class) expect(plugin.name).to eq('Bold') end it 'converts symbol to plugin instance' do plugin = described_class.normalize(:Bold) expect(plugin).to be_a(described_class) expect(plugin.name).to eq(:Bold) end it 'returns existing plugin instances unchanged' do original = described_class.new(:Bold) plugin = described_class.normalize(original) expect(plugin).to be(original) end it 'returns inline plugin instances unchanged' do inline = CKEditor5::Rails::Editor::PropsInlinePlugin.new(:Custom, 'return class {}') plugin = described_class.normalize(inline) expect(plugin).to be(inline) end it 'raises error for invalid input' do expect { described_class.normalize({}) }.to raise_error(ArgumentError) end end describe '#preload_assets_bundle' do it 'returns nil by default' do plugin = described_class.new(:Bold) expect(plugin.preload_assets_bundle).to be_nil end end describe '#to_h' do it 'raises NotImplementedError' do plugin = described_class.new(:Bold) expect do plugin.to_h end.to raise_error(NotImplementedError, 'Method #to_h must be implemented in a subclass') end end describe '#name' do it 'returns the plugin name' do plugin = described_class.new(:Bold) expect(plugin.name).to eq(:Bold) end it 'preserves the type of name argument' do string_plugin = described_class.new('Bold') symbol_plugin = described_class.new(:Bold) expect(string_plugin.name).to eq('Bold') expect(symbol_plugin.name).to eq(:Bold) end end end
Version data entries
10 entries across 10 versions & 2 rubygems