Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
Add not equals support to mapper
Dieser Commit ist enthalten in:
Ursprung
461e617453
Commit
4c784d98e6
6 geänderte Dateien mit 32 neuen und 1 gelöschten Zeilen
|
@ -35,6 +35,7 @@ function inputTypesContent(options = {}) {
|
|||
const connectors = {
|
||||
pair: [
|
||||
"equal",
|
||||
"not_equal",
|
||||
"greater",
|
||||
"less",
|
||||
"greater_or_equal",
|
||||
|
|
|
@ -324,6 +324,7 @@ en:
|
|||
then: "then"
|
||||
set: "set"
|
||||
equal: '='
|
||||
not_equal: '!='
|
||||
greater: '>'
|
||||
less: '<'
|
||||
greater_or_equal: '>='
|
||||
|
|
|
@ -30,6 +30,7 @@ class CustomWizard::Mapper
|
|||
|
||||
OPERATORS = {
|
||||
equal: '==',
|
||||
not_equal: "!=",
|
||||
greater: '>',
|
||||
less: '<',
|
||||
greater_or_equal: '>=',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
# name: discourse-custom-wizard
|
||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
||||
# version: 2.3.2
|
||||
# version: 2.3.3
|
||||
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever
|
||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||
# contact_emails: development@pavilion.tech
|
||||
|
|
|
@ -291,6 +291,19 @@ describe CustomWizard::Mapper do
|
|||
end
|
||||
end
|
||||
|
||||
it "handles not equal pairs" do
|
||||
expect(CustomWizard::Mapper.new(
|
||||
inputs: inputs['not_equals_pair'],
|
||||
data: data,
|
||||
user: user1
|
||||
).perform).to eq(true)
|
||||
expect(CustomWizard::Mapper.new(
|
||||
inputs: inputs['not_equals_pair'],
|
||||
data: data,
|
||||
user: user2
|
||||
).perform).to eq(false)
|
||||
end
|
||||
|
||||
it "handles greater than pairs" do
|
||||
expect(CustomWizard::Mapper.new(
|
||||
inputs: inputs['greater_than_pair'],
|
||||
|
|
15
spec/fixtures/mapper/inputs.json
gevendort
15
spec/fixtures/mapper/inputs.json
gevendort
|
@ -195,6 +195,21 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"not_equals_pair": [
|
||||
{
|
||||
"type": "validation",
|
||||
"pairs": [
|
||||
{
|
||||
"index": 0,
|
||||
"key": "trust_level",
|
||||
"key_type": "user_field",
|
||||
"value": "1",
|
||||
"value_type": "text",
|
||||
"connector": "not_equal"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"greater_than_pair": [
|
||||
{
|
||||
"type": "validation",
|
||||
|
|
Laden …
In neuem Issue referenzieren