-
Notifications
You must be signed in to change notification settings - Fork 197
Expand file tree
/
Copy pathcss_selectors.rb
More file actions
115 lines (87 loc) · 2.74 KB
/
css_selectors.rb
File metadata and controls
115 lines (87 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
module CssSelectors
include ActionView::RecordIdentifier
def record_css_selector(object, prefix = nil)
"##{dom_id(object, prefix)}"
end
def search_result_css_selector(object)
"##{object.type.underscore}_#{object.content_id}"
end
def record_id_from(element)
element["id"].split("_").last
end
def records_from_elements(klass, elements)
klass.find(elements.map { |element| record_id_from(element) })
end
def organisations_selector
"#organisations"
end
def topics_selector
"#topics"
end
def ministers_responsible_selector
"#ministers_responsible"
end
def metadata_nav_selector
".meta"
end
def corporate_publications_selector
"#corporate-publications"
end
def inapplicable_nations_selector
".inapplicable-nations"
end
def parent_organisations_list_selector
"select[name='organisation[parent_organisation_ids][]']"
end
def organisation_type_list_selector
"select[name='organisation[organisation_type_id]']"
end
def organisation_topics_list_selector
"select[name='organisation[topical_event_organisations_attributes][][topical_event_id]']"
end
def organisation_govuk_status_selector
"select[name='organisation[govuk_status]']"
end
def management_selector
"#management"
end
def special_representative_selector
"#special_representatives"
end
def featured_documents_selector
"#featured-documents"
end
def world_locations_selector
"#world-locations"
end
def publish_link_selector(document)
"a[href='#{confirm_publish_admin_edition_path(document, lock_version: document.lock_version)}']"
end
def force_publish_button_selector(document)
"a[href='#{confirm_force_publish_admin_edition_path(document, lock_version: document.lock_version)}']"
end
def reject_button_selector(document)
"form[action='#{reject_admin_edition_path(document, lock_version: document.lock_version)}'] button[type=submit]"
end
def schedule_button_selector(document)
"form[action='#{schedule_admin_edition_path(document, lock_version: document.lock_version)}'] button[type=submit]"
end
def unschedule_button_selector(document)
"a[href='#{confirm_unschedule_admin_edition_path(document, lock_version: document.lock_version)}']"
end
def force_schedule_button_selector(document)
"a[href='#{confirm_force_schedule_admin_edition_path(document, lock_version: document.lock_version)}']"
end
def link_to_public_version_selector(document)
"a[href='#{document.public_url}']"
end
def link_to_preview_version_selector(document)
"a[href^='#{document.public_url(draft: true)}?cachebust=']"
end
def policy_group_selector
".document-policy-groups"
end
def row_containing(text)
page.find("tr", text:)
end
end