Update to latest Houdini v1 changes
This commit is contained in:
commit
9e7e62c1e7
25 changed files with 24546 additions and 499 deletions
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG]"
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--- Provide a general summary of the issue in the Title above -->
|
||||
|
||||
## Description
|
||||
<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
|
||||
|
||||
## Expected Behavior
|
||||
<!--- Tell us what should happen -->
|
||||
|
||||
## Actual Behavior
|
||||
<!--- Tell us what happens instead -->
|
||||
|
||||
## Possible Fix
|
||||
<!--- Not obligatory, but suggest a fix or reason for the bug -->
|
||||
|
||||
## Steps to Reproduce
|
||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
||||
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
## Context
|
||||
<!--- How has this bug affected you? What were you trying to accomplish? -->
|
||||
|
||||
## Your Environment
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
* Ruby version:
|
||||
* Server type and version:
|
||||
* Operating System and version:
|
||||
* Link to your project:
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Houdini Chat Room
|
||||
url: https://houdini.zulipchat.com
|
||||
about: Please ask and answer questions here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[FEATURE]"
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
5532
NOTICE-ruby
Normal file
5532
NOTICE-ruby
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,23 +1,27 @@
|
|||
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
|
||||
<% schema = {
|
||||
"@context": "http://schema.org",
|
||||
"@type": "Event",
|
||||
"name": "<%= @campaign.name %>",
|
||||
"description": "<%= @campaign.summary.present? ? raw(@campaign.summary) : raw(@campaign.name) %>",
|
||||
"url": "<%= url %>",
|
||||
"name": @campaign.name ,
|
||||
"description": @campaign.summary.present? ? @campaign.summary : @campaign.name ,
|
||||
"url": url ,
|
||||
"location": {
|
||||
"@type": "Place",
|
||||
"name": "<%= @campaign.name %>",
|
||||
"name": @campaign.name ,
|
||||
"address": {
|
||||
"@type": "PostalAddress",
|
||||
"addressLocality": "<%= @nonprofit.city %>",
|
||||
"addressRegion": "<%= @nonprofit.state_code %>",
|
||||
"postalCode": "<%= @nonprofit.zip_code %>",
|
||||
"streetAddress": "<%= @nonprofit.address %>"
|
||||
"addressLocality": @nonprofit.city,
|
||||
"addressRegion": @nonprofit.state_code,
|
||||
"postalCode": @nonprofit.zip_code ,
|
||||
"streetAddress": @nonprofit.address
|
||||
}
|
||||
},
|
||||
"startDate": "<%= @campaign.created_at %>"
|
||||
}
|
||||
"startDate": @campaign.created_at
|
||||
}
|
||||
%>
|
||||
|
||||
<script type="application/ld+json">
|
||||
<%= raw(JSON::generate(schema)) %>
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
|
||||
<%= content_for(:title_prefix) { "#{@campaign.name} - #{@campaign.nonprofit.name} | ".html_safe } %>
|
||||
<% content_for(:fixed_position_cta_hidden) {'hidden'} %>
|
||||
<%= content_for(:meta_description) {raw @campaign.summary} %>
|
||||
<%= content_for(:meta_description) {@campaign.summary} %>
|
||||
<% @brand_color = @nonprofit.brand_color ? @nonprofit.brand_color : nil %>
|
||||
|
||||
<%= content_for :javascripts do %>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<% if donation.campaign && donation.campaign.published %>
|
||||
<tr>
|
||||
<td><strong><%= t('donation.campaign') %></strong></td>
|
||||
<td><a href='<%= nonprofit_campaign_url(donation.nonprofit, donation.campaign) %>'><%= donation.campaign.name %></a><small>(Campaign Id: <%= donation.campaign.id%>, Creator: <a href="mailto:<%= donation.campaign.profile.user.email %>"><%= donation.campaign.profile.user.email %></a>)</small></td>
|
||||
<td><a href='<%= nonprofit_campaign_url(donation.nonprofit, donation.campaign) %>'><%= donation.campaign.name %></a><small>(Campaign Id: <%= donation.campaign.id%><% if @show_campaign_creator %>, Creator: <a href="mailto:<%= donation.campaign.profile.user.email %>"><%= donation.campaign.profile.user.email %></a><% end %>)</small></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<%= render 'components/email/supporter_table', supporter: @donation.supporter %>
|
||||
<br>
|
||||
|
||||
<% @show_campaign_creator = true%>
|
||||
<%= render 'donation_mailer/donation_payment_table', donation: @donation, charge: @charge %>
|
||||
|
||||
<% if @donation.recurring_donation %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
|
||||
<%= content_for(:title_prefix) {"#{@event.name} - #{@event.nonprofit.name}".html_safe} %>
|
||||
<%= content_for(:meta_description) {raw @event.summary} %>
|
||||
<%= content_for(:meta_description) {@event.summary.html_safe} %>
|
||||
<%= content_for(:stylesheets) {stylesheet_link_tag 'events/show/page'} %>
|
||||
<% content_for(:fixed_position_cta_hidden) {'hidden'} %>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
|
||||
<%= content_for(:title) {"#{@event.name} - #{@event.nonprofit.name}".html_safe} %>
|
||||
<%= content_for(:meta_description) {raw @event.summary} %>
|
||||
<%= content_for(:meta_description) {@event.summary} %>
|
||||
<%= content_for(:stylesheets) {stylesheet_link_tag 'events/stats/page'} %>
|
||||
<% content_for(:footer_hidden) {'hidden'} %>
|
||||
<% content_for(:fixed_position_cta_hidden) {'hidden'} %>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<% description = "Robust and user-friendly nonprofit fundraising tools. Campaigns, donor management, donation processing and event ticketing." %>
|
||||
|
||||
<title><%= yield :title_prefix %><%= Settings.general.name %> <%= content_for?(:title_suffix) ? yield(:title_suffix) : "| #{title}" %>
|
||||
<title><%= yield :title_prefix %> <%= Settings.general.name %> <%= content_for?(:title_suffix) ? yield(:title_suffix) : "| #{title}" %>
|
||||
</title>
|
||||
|
||||
<% if content_for?(:meta_description) %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
|
||||
<% content_for(:title_prefix) {"#{@nonprofit.name} - #{@nonprofit.city}, #{@nonprofit.state_code} | ".html_safe} %>
|
||||
<% content_for(:fixed_position_cta_hidden) {'hidden'} %>
|
||||
<% content_for(:meta_description) {raw @nonprofit.summary} %>
|
||||
<% content_for(:meta_description) {@nonprofit.summary} %>
|
||||
<% @brand_color = @nonprofit.brand_color ? @nonprofit.brand_color : nil %>
|
||||
|
||||
<%= content_for :facebook_tags do %>
|
||||
|
|
|
@ -163,6 +163,8 @@ module Mailchimp
|
|||
end
|
||||
|
||||
# @param [EmailList] email_list
|
||||
# Notably, if a supporter unsubscribed on Mailchimp, this will not
|
||||
# resubscribe them. This is the correct behavior.
|
||||
def self.hard_sync_list(email_list)
|
||||
ops = generate_batch_ops_for_hard_sync(email_list)
|
||||
perform_batch_operations(email_list.nonprofit.id, ops)
|
||||
|
|
22
lib/tasks/bundler_notice.rake
Normal file
22
lib/tasks/bundler_notice.rake
Normal file
|
@ -0,0 +1,22 @@
|
|||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||
desc "generating a notice for bundler"
|
||||
|
||||
# Clear old activerecord sessions tables daily
|
||||
task :bundler_notice => :environment do
|
||||
require 'bundler'
|
||||
require 'httparty'
|
||||
parser = Bundler::LockfileParser.new(File.read(Rails.root.join("Gemfile.lock")))
|
||||
result = parser.specs.map do |spec|
|
||||
"gem/rubygems/-/#{spec.name}/#{spec.version.to_s}"
|
||||
end
|
||||
|
||||
@options = {
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
}
|
||||
|
||||
result = HTTParty.post("https://api.clearlydefined.io/notices", @options.merge(body:JSON::generate({coordinates: result})))
|
||||
byebug
|
||||
end
|
|
@ -108,6 +108,7 @@
|
|||
"moment-range": "2.2.0",
|
||||
"moment-timezone": "^0.5.21",
|
||||
"no-scroll": "^2.1.0",
|
||||
"noticeme": "0.0.2",
|
||||
"parsleyjs": "2.0.7",
|
||||
"percent": "1.1.1",
|
||||
"phone-formatter": "0.0.2",
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/bash
|
||||
yarn ci && rake db:create db:structure:load db:migrate && RAILS_ENV=test rake db:create db:structure:load test:prepare && rake spec && yarn run build-all && yarn jest
|
||||
yarn ci && rake db:create db:structure:load db:migrate && RAILS_ENV=test rake db:create db:structure:load test:prepare && rake spec && yarn run build-all && yarn jest
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
// License: LGPL-3.0-or-later
|
||||
mocha.setup({globals: ['google*']})
|
||||
import './nonprofits'
|
||||
|
||||
/*
|
||||
window.$ = require("jquery")
|
||||
window.jQuery = window.$
|
||||
window.domify = require("domify")
|
||||
window.app = {}
|
||||
require("../../app/assets/javascripts/common/vendor/jquery.cookie")
|
||||
|
||||
$(document).ready(function(){
|
||||
window.appl = require("../../app/assets/javascripts/common/application_view")
|
||||
require("./common/utilities-spec")
|
||||
require("./nonprofits/donate/wizard-spec")
|
||||
require("./nonprofits/donate/amount-step-spec")
|
||||
})
|
||||
*/
|
|
@ -1,11 +0,0 @@
|
|||
// License: LGPL-3.0-or-later
|
||||
window.$ = require("jquery")
|
||||
window.jQuery = window.$
|
||||
window.domify = require("domify")
|
||||
window.app = {}
|
||||
require("../../../app/assets/javascripts/common/vendor/jquery.cookie")
|
||||
|
||||
$(document).ready(function(){
|
||||
window.appl = require("../../../app/assets/javascripts/common/application_view")
|
||||
require("./utilities_spec")
|
||||
})
|
|
@ -1,108 +0,0 @@
|
|||
// License: LGPL-3.0-or-later
|
||||
var utils = require("../../../app/assets/javascripts/common/utilities")
|
||||
|
||||
var fruit = { name: "banana", color: "yellow", flavor: "sweet" }
|
||||
var vegetable = { name: "corn", color: "yellow", season: "summer"}
|
||||
|
||||
describe("utils.vals", function() {
|
||||
it("takes an object and returns an array of values", function() {
|
||||
expect(utils.vals(fruit)).toEqual(["banana", "yellow", "sweet"])
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.keys", function() {
|
||||
it("takes an object and returns an array of keys", function() {
|
||||
expect(utils.keys(fruit)).toEqual(["name", "color", "flavor"])
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.zero_pad", function() {
|
||||
it("takes an initial number and the desired length of the number \
|
||||
and returns the initial number with with zero's prepended to it", function() {
|
||||
expect(utils.zero_pad(666, 10)).toBe("0000000666")
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.simple_date_from_string", function() {
|
||||
it("takes a loose string representation of a date and \
|
||||
returns a uniform representaion", function() {
|
||||
expect(utils.simple_date_from_string("Sun, 27 Sep 2015 12:00:00 UTC")).toBe("09/27/2015")
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.number_with_comma", function() {
|
||||
it("takes a number and returns a string with the number \
|
||||
seperated by a comma at every three digits", function() {
|
||||
expect(utils.number_with_commas(6666666666666)).toBe("6,666,666,666,666")
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.merge", function() {
|
||||
it("takes two objects and merges them (favors second object's \
|
||||
values if the objects have same keys) ", function() {
|
||||
expect(utils.merge(fruit, vegetable)).toEqual({name: "corn", color: "yellow", flavor: "sweet", season: "summer"})
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.cents_to_dollars", function() {
|
||||
it("takes a number representing an amount in cents and returns \
|
||||
that amount representing a dollars", function() {
|
||||
expect(utils.cents_to_dollars(666)).toBe("6.66")
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.dollars_to_cents", function() {
|
||||
it("takes a number representing an amount in dollars and returns \
|
||||
that amount representing cents", function() {
|
||||
expect(utils.dollars_to_cents(6.66)).toBe(666)
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.trim", function() {
|
||||
it("takes a string and removes any leading or trailing white space", function() {
|
||||
expect(utils.trim(' whoa! ')).toBe('whoa!')
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.flatten", function() {
|
||||
it("takes an array of arrays and returns one flattened array", function() {
|
||||
expect(utils.flatten([[1,2],[3,4]])).toEqual([1,2,3,4])
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.uniq", function() {
|
||||
it("takes an array and returns the array with no duplicates", function() {
|
||||
expect(utils.uniq(['beer', 'wine', 'beer', 'mescal', 'beer', 'wine'])).toEqual(['beer', 'wine', 'mescal'])
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.address_with_commas", function() {
|
||||
it("takes a street, address and state and return them seperated by commas", function() {
|
||||
expect(utils.address_with_commas('1600 Pennsylvania Ave NW', 'Washington', 'DC' )).toEqual('1600 Pennsylvania Ave NW, Washington, DC')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// pending...
|
||||
|
||||
xdescribe("utils.get_param", function() {
|
||||
var location = {}
|
||||
|
||||
beforeAll(function() {
|
||||
location.search = '?id=666'
|
||||
})
|
||||
afterAll(function() {
|
||||
location.search = ''
|
||||
})
|
||||
xit("returns url params as a string", function() {
|
||||
expect(utils.get_param('id')).toEqual('666')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
xdescribe("utils.toFormData", function() {
|
||||
xit("takes a form and returns an object using the form inputs' attribute names as keys ", function() {
|
||||
expect(utils.foFormData(form_object)).toBe('....')
|
||||
})
|
||||
})
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
// License: LGPL-3.0-or-later
|
||||
var utils = require("../../../app/assets/javascripts/common/utilities")
|
||||
|
||||
var fruit = { name: "banana", color: "yellow", flavor: "sweet" }
|
||||
var vegetable = { name: "corn", color: "yellow", season: "summer"}
|
||||
|
||||
describe("utils.vals", function() {
|
||||
it("takes an object and returns an array of values", function() {
|
||||
expect(utils.vals(fruit)).toEqual(["banana", "yellow", "sweet"])
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.keys", function() {
|
||||
it("takes an object and returns an array of keys", function() {
|
||||
expect(utils.keys(fruit)).toEqual(["name", "color", "flavor"])
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.zero_pad", function() {
|
||||
it("takes an initial number and the desired length of the number \
|
||||
and returns the initial number with with zero's prepended to it", function() {
|
||||
expect(utils.zero_pad(666, 10)).toBe("0000000666")
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.simple_date_from_string", function() {
|
||||
it("takes a loose string representation of a date and \
|
||||
returns a uniform representaion", function() {
|
||||
expect(utils.simple_date_from_string("Sun, 27 Sep 2015 00:00:00 UTC")).toBe("09/27/2015")
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.number_with_comma", function() {
|
||||
it("takes a number and returns a string with the number \
|
||||
seperated by a comma at every three digits", function() {
|
||||
expect(utils.number_with_commas(6666666666666)).toBe("6,666,666,666,666")
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.merge", function() {
|
||||
it("takes two objects and merges them (favors second object's \
|
||||
values if the objects have same keys) ", function() {
|
||||
expect(utils.merge(fruit, vegetable)).toEqual({name: "corn", color: "yellow", flavor: "sweet", season: "summer"})
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.cents_to_dollars", function() {
|
||||
it("takes a number representing an amount in cents and returns \
|
||||
that amount representing a dollars", function() {
|
||||
expect(utils.cents_to_dollars(666)).toBe("6.66")
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.dollars_to_cents", function() {
|
||||
it("takes a number representing an amount in dollars and returns \
|
||||
that amount representing cents", function() {
|
||||
expect(utils.dollars_to_cents(6.66)).toBe(666)
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.trim", function() {
|
||||
it("takes a string and removes any leading or trailing white space", function() {
|
||||
expect(utils.trim(' whoa! ')).toBe('whoa!')
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.flatten", function() {
|
||||
it("takes an array of arrays and returns one flattened array", function() {
|
||||
expect(utils.flatten([[1,2],[3,4]])).toEqual([1,2,3,4])
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.uniq", function() {
|
||||
it("takes an array and returns the array with no duplicates", function() {
|
||||
expect(utils.uniq(['beer', 'wine', 'beer', 'mescal', 'beer', 'wine'])).toEqual(['beer', 'wine', 'mescal'])
|
||||
})
|
||||
})
|
||||
|
||||
describe("utils.address_with_commas", function() {
|
||||
it("takes a street, address and state and return them seperated by commas", function() {
|
||||
expect(utils.address_with_commas('1600 Pennsylvania Ave NW', 'Washington', 'DC' )).toEqual('1600 Pennsylvania Ave NW, Washington, DC')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// pending...
|
||||
|
||||
xdescribe("utils.get_param", function() {
|
||||
var location = {}
|
||||
|
||||
beforeAll(function() {
|
||||
location.search = '?id=666'
|
||||
})
|
||||
afterAll(function() {
|
||||
location.search = ''
|
||||
})
|
||||
xit("returns url params as a string", function() {
|
||||
expect(utils.get_param('id')).toEqual('666')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
xdescribe("utils.toFormData", function() {
|
||||
xit("takes a form and returns an object using the form inputs' attribute names as keys ", function() {
|
||||
expect(utils.foFormData(form_object)).toBe('....')
|
||||
})
|
||||
})
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
// License: LGPL-3.0-or-later
|
||||
const snabbdom = require('snabbdom')
|
||||
const flyd = require('flyd')
|
||||
const render = require('ff-core/render')
|
||||
const amount = require("../../../../client/js/nonprofits/donate/amount-step")
|
||||
const R = require('ramda')
|
||||
const assert = require('assert')
|
||||
|
||||
window.log = x => y => console.log(x,y)
|
||||
window.app = {
|
||||
nonprofit: {
|
||||
id: 1
|
||||
, name: 'test npo'
|
||||
, logo: { normal: {url: 'xyz.com'} }
|
||||
, tagline: 'whasup'
|
||||
}
|
||||
}
|
||||
|
||||
const patch = snabbdom.init([
|
||||
require('snabbdom/modules/eventlisteners')
|
||||
, require('snabbdom/modules/class')
|
||||
, require('snabbdom/modules/props')
|
||||
, require('snabbdom/modules/style')
|
||||
])
|
||||
|
||||
const init = (donationDefaults, params$) => {
|
||||
let div = document.createElement('div')
|
||||
let state = amount.init(donationDefaults||{}, params$||flyd.stream({}))
|
||||
let streams = render({
|
||||
container: div
|
||||
, state: state
|
||||
, patch: patch
|
||||
, view: amount.view
|
||||
})
|
||||
streams.state = state
|
||||
return streams
|
||||
}
|
||||
|
||||
const allText = R.map(R.prop('textContent'))
|
||||
const defaultDesigOptions = ['Choose a designation (optional)', 'Use my donation where most needed']
|
||||
|
||||
suite("donate wiz / amount step")
|
||||
test("shows a designation dropdown if the multiple_designations param is set", ()=> {
|
||||
let streams = init({}, flyd.stream({multiple_designations: ['a','b']}))
|
||||
let options = allText(streams.dom$().querySelectorAll('.donate-designationDropdown option'))
|
||||
assert.deepEqual(options, R.concat(defaultDesigOptions, ['a', 'b']))
|
||||
})
|
||||
|
||||
test('sets no designation with a dropdown on the default value', () => {
|
||||
let streams = init({}, flyd.stream({multiple_designations: ['a', 'b']}))
|
||||
let change = document.createEvent('Event')
|
||||
change.initEvent('change', false, false, null )
|
||||
let select = streams.dom$().querySelector('.donate-designationDropdown')
|
||||
select.selectedIndex = 0
|
||||
select.dispatchEvent(change)
|
||||
assert.equal(streams.state.donation$().designation, '')
|
||||
select.selectedIndex = 1
|
||||
select.dispatchEvent(change)
|
||||
assert.equal(streams.state.donation$().designation, '')
|
||||
})
|
||||
|
||||
test("changing the dropdown sets the designation", () => {
|
||||
let streams = init({}, flyd.stream({multiple_designations: ['a', 'b']}))
|
||||
let change = document.createEvent('Event')
|
||||
change.initEvent('change', false, false, null )
|
||||
let select = streams.dom$().querySelector('.donate-designationDropdown')
|
||||
select.selectedIndex = 2
|
||||
select.dispatchEvent(change)
|
||||
assert.equal(streams.state.donation$().designation, 'a')
|
||||
})
|
||||
|
||||
test("shows no dropdown if the multiple_designations param is not set", ()=> {
|
||||
let streams = init()
|
||||
let drop = streams.dom$().querySelector('.donate-designationDropdown')
|
||||
assert.equal(drop, null)
|
||||
})
|
||||
|
||||
test("shows a recurring donation checkbox by default", ()=> {
|
||||
let streams = init()
|
||||
assert(streams.dom$().querySelector('.donate-recurringCheckbox'))
|
||||
})
|
||||
|
||||
test("hides the recurring donation checkbox if params type is set to recurring", ()=> {
|
||||
let streams = init({}, flyd.stream({type: 'recurring'}))
|
||||
let check = streams.dom$().querySelector('.donate-recurringCheckbox')
|
||||
assert.equal(check, null)
|
||||
})
|
||||
|
||||
test("shows a recurring message if the recurring box is checked", ()=> {
|
||||
let streams = init()
|
||||
let change = document.createEvent('Event')
|
||||
change.initEvent('change', false, false, null )
|
||||
streams.dom$().querySelector('.donate-recurringCheckbox input').dispatchEvent(change)
|
||||
const msg = streams.dom$().querySelector('.donate-recurringMessage').textContent
|
||||
assert.equal(msg, 'Select an amount for your monthly contribution')
|
||||
})
|
||||
|
||||
test("shows a recurring message if the type in params is set to recurring", ()=> {
|
||||
let streams = init({}, flyd.stream({type: 'recurring'}))
|
||||
const msg = streams.dom$().querySelector('.donate-recurringMessage').textContent
|
||||
assert.equal(msg, 'Select an amount for your monthly contribution')
|
||||
})
|
||||
|
||||
test("does not show a recurring message if the type is one-time in params", ()=> {
|
||||
let streams = init({}, flyd.stream({type: 'one-time'}))
|
||||
const msg = streams.dom$().querySelector('.donate-recurringMessage')
|
||||
assert.equal(msg, null)
|
||||
})
|
||||
|
||||
test("does not show a recurring message if the type is one-time in params", ()=> {
|
||||
let streams = init({}, flyd.stream({type: 'one-time'}))
|
||||
const msg = streams.dom$().querySelector('.donate-recurringCheckbox')
|
||||
assert.equal(msg, null)
|
||||
})
|
|
@ -1,116 +0,0 @@
|
|||
// License: LGPL-3.0-or-later
|
||||
const snabbdom = require('snabbdom')
|
||||
const flyd = require('flyd')
|
||||
const render = require('ff-core/render')
|
||||
const wiz = require("../../../../client/js/nonprofits/donate/wizard")
|
||||
const R = require('ramda')
|
||||
const assert = require('assert')
|
||||
|
||||
window.log = x => y => console.log(x,y)
|
||||
window.app = {
|
||||
nonprofit: {
|
||||
id: 1
|
||||
, name: 'test npo'
|
||||
, logo: { normal: {url: 'xyz.com'} }
|
||||
, tagline: 'whasup'
|
||||
}
|
||||
}
|
||||
|
||||
const patch = snabbdom.init([
|
||||
require('snabbdom/modules/eventlisteners')
|
||||
, require('snabbdom/modules/class')
|
||||
, require('snabbdom/modules/props')
|
||||
, require('snabbdom/modules/style')
|
||||
])
|
||||
|
||||
const init = params$=> {
|
||||
params$ = params$ || flyd.stream({})
|
||||
let div = document.createElement('div')
|
||||
let state = wiz.init(params$)
|
||||
let streams = render({
|
||||
container: div
|
||||
, state: state
|
||||
, patch: patch
|
||||
, view: wiz.view
|
||||
})
|
||||
streams.state = state
|
||||
return streams
|
||||
}
|
||||
|
||||
suite("donate wizzzzz")
|
||||
test("initializes amount, info, and payment steps", ()=> {
|
||||
let streams = init()
|
||||
let labels = streams.dom$().querySelectorAll('.ff-wizard-index-label')
|
||||
assert.deepEqual(R.map(R.prop('textContent'), labels), ['Amount', 'Info', 'Payment'])
|
||||
})
|
||||
|
||||
test("shows the nonprofit name without a campaign", () => {
|
||||
let streams = init()
|
||||
let title = streams.dom$().querySelector('.titleRow-info h2').textContent
|
||||
assert.equal(title, app.nonprofit.name)
|
||||
})
|
||||
|
||||
test("shows the campaign name with a campaign", () => {
|
||||
let streams = init()
|
||||
let title = streams.dom$().querySelector('.titleRow-info h2').textContent
|
||||
assert.equal(title, app.nonprofit.name)
|
||||
})
|
||||
|
||||
test("shows the campaign tagline with a campaign", () => {
|
||||
app.campaign = {name: 'campaignxyz', id: 1}
|
||||
let streams = init()
|
||||
let title = streams.dom$().querySelector('.titleRow-info h2').textContent
|
||||
assert.equal(title, app.campaign.name)
|
||||
app.campaign = {}
|
||||
})
|
||||
|
||||
test('adds .is-modal class if state.params.offsite$()', ()=> {
|
||||
let streams = init(flyd.stream({offsite: true}))
|
||||
assert.equal(streams.dom$().className.indexOf('is-modal'), 0)
|
||||
})
|
||||
|
||||
test('shows the tagline if no designation and no single amount', ()=> {
|
||||
let streams = init()
|
||||
assert.equal(streams.dom$().querySelector('.titleRow-info p').textContent, app.nonprofit.tagline)
|
||||
})
|
||||
|
||||
test('shows the designation if designation param set and no single amount', ()=> {
|
||||
const designation = '1312312xyz'
|
||||
let streams = init(flyd.stream({designation}))
|
||||
assert.equal(streams.dom$().querySelector('.titleRow-info p').textContent, ` Designation: ${designation}`)
|
||||
})
|
||||
|
||||
test('shows the designation description if it is set and designation param set and no single amount', ()=> {
|
||||
const designation = '1312312xyz'
|
||||
const designation_desc = 'desc23923943'
|
||||
let streams = init(flyd.stream({designation, designation_desc}))
|
||||
assert.equal(streams.dom$().querySelector('.titleRow-info p').textContent, ` Designation: ${designation}${designation_desc}`)
|
||||
})
|
||||
|
||||
test('shows the tagline if designation param set and single amount set', ()=> {
|
||||
const designation = '1312312xyz'
|
||||
let streams = init(flyd.stream({designation, single_amount: 1000}))
|
||||
assert.equal(streams.dom$().querySelector('.titleRow-info p').textContent, app.nonprofit.tagline)
|
||||
})
|
||||
|
||||
test('hides the footer if no user is in the env', () => {
|
||||
let streams = init()
|
||||
const idx = streams.dom$().querySelector('.donateForm-footer').className.indexOf('hide')
|
||||
assert.notEqual(idx, -1)
|
||||
})
|
||||
|
||||
test('shows the footer if a user is in the env', () => {
|
||||
app.user = {email: 'user@example.com', id: 1}
|
||||
let streams = init()
|
||||
const idx = streams.dom$().querySelector('.donateForm-footer').className.indexOf('hide')
|
||||
assert.equal(idx, -1)
|
||||
app.user = {}
|
||||
})
|
||||
|
||||
test('shows user info text if a user is in the env', () => {
|
||||
app.user = {email: 'user@example.com', id: 1}
|
||||
let streams = init()
|
||||
const text = streams.dom$().querySelector('.donateForm-footer').textContent
|
||||
assert.equal(text, 'Signed in as user@example.com Logout')
|
||||
app.user = {}
|
||||
})
|
|
@ -1,3 +0,0 @@
|
|||
// License: LGPL-3.0-or-later
|
||||
import './donate/amount-step-spec'
|
||||
import './donate/wizard-spec'
|
78
yarn.lock
78
yarn.lock
|
@ -1858,6 +1858,11 @@ array.prototype.flat@^1.2.3:
|
|||
define-properties "^1.1.3"
|
||||
es-abstract "^1.17.0-next.1"
|
||||
|
||||
asap@^2.0.0:
|
||||
version "2.0.6"
|
||||
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"
|
||||
integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=
|
||||
|
||||
asn1.js@^4.0.0:
|
||||
version "4.10.1"
|
||||
resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0"
|
||||
|
@ -3525,6 +3530,11 @@ debug@^4.1.0, debug@^4.1.1:
|
|||
dependencies:
|
||||
ms "^2.1.1"
|
||||
|
||||
debuglog@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
|
||||
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
|
||||
|
||||
decamelize@^1.1.2, decamelize@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||
|
@ -3662,6 +3672,14 @@ detect-node@^2.0.4:
|
|||
resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c"
|
||||
integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==
|
||||
|
||||
dezalgo@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456"
|
||||
integrity sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=
|
||||
dependencies:
|
||||
asap "^2.0.0"
|
||||
wrappy "1"
|
||||
|
||||
diff-sequences@^24.9.0:
|
||||
version "24.9.0"
|
||||
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5"
|
||||
|
@ -7325,6 +7343,11 @@ no-scroll@^2.1.0, no-scroll@^2.1.1:
|
|||
resolved "https://registry.yarnpkg.com/no-scroll/-/no-scroll-2.1.1.tgz#f37e08cb159b75a5bdbfc0a87cd9223e120e6e27"
|
||||
integrity sha512-YTzGAJOo/B6hkodeT5SKKHpOhAzjMfkUCCXjLJwjWk2F4/InIg+HbdH9kmT7bKpleDuqLZDTRy2OdNtAj0IVyQ==
|
||||
|
||||
node-fetch@^2.6.0:
|
||||
version "2.6.0"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
|
||||
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
|
||||
|
||||
node-forge@0.9.0:
|
||||
version "0.9.0"
|
||||
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579"
|
||||
|
@ -7433,7 +7456,7 @@ node-sass@^4.12.0, node-sass@^4.13.1:
|
|||
dependencies:
|
||||
abbrev "1"
|
||||
|
||||
normalize-package-data@^2.3.2, normalize-package-data@^2.3.4:
|
||||
normalize-package-data@^2.0.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8"
|
||||
integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==
|
||||
|
@ -7475,6 +7498,19 @@ normalize-url@^3.0.0:
|
|||
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559"
|
||||
integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==
|
||||
|
||||
noticeme@0.0.2:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/noticeme/-/noticeme-0.0.2.tgz#61b1d44819f15af67bc72c2234ef4b61c9f1abbe"
|
||||
integrity sha512-W+NWW3pApNeYCR+7jBcxQHtEcxRkHTNF2tlT62NyxpNMi1XCpBMaSmtVHarP+WebXTTEK6/03JexHazdhlRuRQ==
|
||||
dependencies:
|
||||
node-fetch "^2.6.0"
|
||||
read-package-tree "^5.2.2"
|
||||
|
||||
npm-normalize-package-bin@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2"
|
||||
integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==
|
||||
|
||||
npm-run-path@^2.0.0:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
|
||||
|
@ -7592,7 +7628,7 @@ object.fromentries@^2.0.2:
|
|||
function-bind "^1.1.1"
|
||||
has "^1.0.3"
|
||||
|
||||
object.getownpropertydescriptors@^2.1.0:
|
||||
object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz#369bf1f9592d8ab89d712dced5cb81c7c5352649"
|
||||
integrity sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==
|
||||
|
@ -9431,6 +9467,27 @@ read-cache@^1.0.0:
|
|||
dependencies:
|
||||
pify "^2.3.0"
|
||||
|
||||
read-package-json@^2.0.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.1.1.tgz#16aa66c59e7d4dad6288f179dd9295fd59bb98f1"
|
||||
integrity sha512-dAiqGtVc/q5doFz6096CcnXhpYk0ZN8dEKVkGLU0CsASt8SrgF6SF7OTKAYubfvFhWaqofl+Y8HK19GR8jwW+A==
|
||||
dependencies:
|
||||
glob "^7.1.1"
|
||||
json-parse-better-errors "^1.0.1"
|
||||
normalize-package-data "^2.0.0"
|
||||
npm-normalize-package-bin "^1.0.0"
|
||||
optionalDependencies:
|
||||
graceful-fs "^4.1.2"
|
||||
|
||||
read-package-tree@^5.2.2:
|
||||
version "5.3.1"
|
||||
resolved "https://registry.yarnpkg.com/read-package-tree/-/read-package-tree-5.3.1.tgz#a32cb64c7f31eb8a6f31ef06f9cedf74068fe636"
|
||||
integrity sha512-mLUDsD5JVtlZxjSlPPx1RETkNjjvQYuweKwNVt1Sn8kP5Jh44pvYuUHCp6xSVDZWbNxVxG5lyZJ921aJH61sTw==
|
||||
dependencies:
|
||||
read-package-json "^2.0.0"
|
||||
readdir-scoped-modules "^1.0.0"
|
||||
util-promisify "^2.1.0"
|
||||
|
||||
read-pkg-up@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"
|
||||
|
@ -9497,6 +9554,16 @@ readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.6.0:
|
|||
string_decoder "^1.1.1"
|
||||
util-deprecate "^1.0.1"
|
||||
|
||||
readdir-scoped-modules@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309"
|
||||
integrity sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==
|
||||
dependencies:
|
||||
debuglog "^1.0.1"
|
||||
dezalgo "^1.0.0"
|
||||
graceful-fs "^4.1.2"
|
||||
once "^1.3.0"
|
||||
|
||||
readdirp@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525"
|
||||
|
@ -11153,6 +11220,13 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1:
|
|||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
|
||||
|
||||
util-promisify@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/util-promisify/-/util-promisify-2.1.0.tgz#3c2236476c4d32c5ff3c47002add7c13b9a82a53"
|
||||
integrity sha1-PCI2R2xNMsX/PEcAKt18E7moKlM=
|
||||
dependencies:
|
||||
object.getownpropertydescriptors "^2.0.3"
|
||||
|
||||
util.promisify@^1.0.0, util.promisify@~1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.1.tgz#6baf7774b80eeb0f7520d8b81d07982a59abbaee"
|
||||
|
|
Loading…
Reference in a new issue