0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-26 11:00:28 +01:00
discourse-custom-wizard/spec/components/custom_wizard/field_spec.rb

32 Zeilen
861 B
Ruby

2021-03-11 07:30:15 +01:00
# frozen_string_literal: true
require_relative '../../plugin_helper'
2020-11-03 01:24:20 +01:00
describe CustomWizard::Field do
2021-03-11 07:30:15 +01:00
before do
2020-11-03 01:24:20 +01:00
CustomWizard::Field.register(
'location',
'discourse-locations',
['components', 'helpers', 'lib', 'stylesheets', 'templates'],
type_opts: {
prefill: { "coordinates": [35.3082, 149.1244] }
}
)
end
2021-03-11 07:30:15 +01:00
it "registers custom field types" do
2020-11-03 01:24:20 +01:00
expect(CustomWizard::Field.types[:location].present?).to eq(true)
end
2021-03-11 07:30:15 +01:00
2020-11-03 01:24:20 +01:00
it "allows custom field types to set default attributes" do
expect(
CustomWizard::Field.types[:location][:prefill]
).to eq({ "coordinates": [35.3082, 149.1244] })
end
2021-03-11 07:30:15 +01:00
2020-11-03 01:24:20 +01:00
it "registers custom field assets" do
expect(
CustomWizard::Field.require_assets['discourse-locations']
).to eq(['components', 'helpers', 'lib', 'stylesheets', 'templates'])
end
2021-03-11 07:30:15 +01:00
end