Skip to content

Commit d5b9fb1

Browse files
committed
merged and fixed failing specs
1 parent 5e935dc commit d5b9fb1

File tree

15 files changed

+63
-84
lines changed

15 files changed

+63
-84
lines changed

app/concepts/matestack/ui/core/async/async.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ const componentDef = {
5656
headers: {
5757
'X-CSRF-Token': document.getElementsByName("csrf-token")[0].getAttribute('content')
5858
},
59-
params: {"component_key": self.componentConfig["component_key"]}
59+
params: {
60+
"component_key": self.componentConfig["component_key"],
61+
"component_class": self.componentConfig["parent_class"]
62+
}
6063
})
6164
.then(function(response){
6265
var tmp_dom_element = document.createElement('div');

app/concepts/matestack/ui/core/component/base.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ def prepare
159159

160160
# access params like you would do on rails views and controllers
161161
def params
162-
context[:params]
162+
if @matestack_context.present? && @matestack_context[:controller].present?
163+
@matestack_context[:controller].params
164+
else
165+
context[:params]
166+
end
163167
end
164168

165169
## ------------------ Rendering ----------------

app/concepts/matestack/ui/core/component/dynamic.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def show
1313

1414
def dynamic_tag_attributes
1515
attrs = {
16-
"is": self.class.vue_js_name,
16+
"is": get_vue_js_name,
1717
"ref": component_id,
1818
":params": params.except(:controller, :action).to_json,
1919
":component-config": @component_config.to_json,
@@ -23,6 +23,14 @@ def dynamic_tag_attributes
2323
attrs
2424
end
2525

26+
def get_vue_js_name
27+
if @vue_js_component_name.present?
28+
@vue_js_component_name
29+
else
30+
self.class.vue_js_name
31+
end
32+
end
33+
2634
class << self
2735
def vue_js_component_name(name)
2836
@vue_js_name = name.to_s

app/concepts/matestack/ui/core/isolate/isolate.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
module Matestack::Ui::Core::Isolate
22
class Isolate < Matestack::Ui::Core::Component::Dynamic
33

4-
def vuejs_component_name
5-
"matestack-ui-core-isolate"
6-
end
4+
vue_js_component_name "matestack-ui-core-isolate"
75

86
def initialize(*args)
97
super
108
@public_options = args.map { |hash| hash[:public_options] }[0]
9+
# using this instance var here as users inherit from this class and would need
10+
# to use `vue_js_component_name "matestack-ui-core-isolate"` in their components
11+
# which is not convinient
12+
@vue_js_component_name = "matestack-ui-core-isolate"
1113
end
1214

1315
def public_options

app/concepts/matestack/ui/core/toggle/toggle.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
module Matestack::Ui::Core::Toggle
22
class Toggle < Matestack::Ui::Core::Component::Dynamic
33

4-
def vuejs_component_name
5-
"matestack-ui-core-toggle"
6-
end
4+
vue_js_component_name "matestack-ui-core-toggle"
75

86
def initialize(*args)
97
super

app/concepts/matestack/ui/core/transition/transition.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const componentDef = {
2121
const self = this
2222
matestackEventHub.$emit("page_loading_triggered", url);
2323
this.$store.commit('setPageLoading', true);
24-
this.$store.commit('setPageLoadingStart', true);
25-
this.$store.commit('setPageLoadingEnd', false)
2624
if (self.componentConfig["delay"] != undefined) {
2725
setTimeout(function () {
2826
self.performNavigation(url)

spec/0.8/base/core/app/layout_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def page2
6161
visit "app_layout_spec/layout_page1"
6262

6363
expect(page).to have_xpath('//div[@class="matestack-app-wrapper"]/h1[contains(.,"My Example App Layout")]')
64-
expect(page).to have_xpath('//div[@class="matestack-app-wrapper"]/main/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[@id="my-div-on-page-1"]/h2[contains(.,"This is Page 1")]')
64+
expect(page).to have_xpath('//div[@class="matestack-app-wrapper"]/main/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[@id="my-div-on-page-1"]/h2[contains(.,"This is Page 1")]')
6565

6666
visit "app_layout_spec/layout_page2"
6767
expect(page).to have_xpath('//div[@class="matestack-app-wrapper"]/h1[contains(.,"My Example App Layout")]')
68-
expect(page).to have_xpath('//div[@class="matestack-app-wrapper"]/main/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[@id="my-div-on-page-2"]/h2[contains(.,"This is Page 2")]')
68+
expect(page).to have_xpath('//div[@class="matestack-app-wrapper"]/main/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[@id="my-div-on-page-2"]/h2[contains(.,"This is Page 2")]')
6969
end
7070

7171
end

spec/0.8/base/core/render/app_resolving_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def example
3939
visit "render_app_resolving_spec/example"
4040

4141
# dom structure implies correct rendering with wrapping minimal app
42-
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[1]').text
42+
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[1]').text
4343
expect(text).to eq("hello from page")
4444
end
4545

@@ -86,11 +86,11 @@ def second_example
8686

8787
visit "render_app_resolving_spec/example"
8888
# dom structure implies correct rendering with wrapping specified app
89-
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-app-layout"]/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[1]').text
89+
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-app-layout"]/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[1]').text
9090

9191
visit "render_app_resolving_spec/second_example"
9292
# dom structure implies correct rendering with wrapping specified app
93-
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-other-app-layout"]/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[1]').text
93+
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-other-app-layout"]/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[1]').text
9494
expect(text).to eq("hello from page")
9595
end
9696

@@ -138,12 +138,12 @@ def second_example
138138

139139
visit "render_app_resolving_spec/example"
140140
# dom structure implies correct rendering with wrapping specified app
141-
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-app-layout"]/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[1]').text
141+
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-app-layout"]/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[1]').text
142142
expect(text).to eq("hello from page")
143143

144144
visit "render_app_resolving_spec/second_example"
145145
# dom structure implies correct rendering with wrapping specified app
146-
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-other-app-layout"]/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[1]').text
146+
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-other-app-layout"]/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[1]').text
147147
expect(text).to eq("hello from page")
148148
end
149149

@@ -174,7 +174,7 @@ def second_example
174174

175175
visit "render_app_resolving_spec/example"
176176
# dom structure implies correct rendering with wrapping specified app
177-
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[1]').text
177+
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[1]').text
178178
expect(text).to eq("hello from page")
179179

180180
visit "render_app_resolving_spec/second_example"
@@ -240,12 +240,12 @@ def second_example
240240

241241
visit "render_app_resolving_spec/example"
242242
# dom structure implies correct rendering with wrapping specified app
243-
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-app-layout"]/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[1]').text
243+
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-app-layout"]/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[1]').text
244244
expect(text).to eq("hello from example page")
245245

246246
visit "render_app_resolving_spec/second_example"
247247
# dom structure implies correct rendering with wrapping specified app
248-
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-other-app-layout"]/div[@class="matestack-page-container loading-end"]/div[@class="matestack-page-wrapper loading-end"]/div/div[@class="matestack-page"]/div[1]').text
248+
text = find(:xpath, 'id("matestack-ui")/div[@class="matestack-app-wrapper"]/div[@class="my-other-app-layout"]/div[@class="matestack-page-container"]/div[@class="matestack-page-wrapper"]/div/div[@class="matestack-page"]/div[1]').text
249249
expect(text).to eq("hello from some other example page")
250250
end
251251

spec/0.8/components/async_new_spec.rb

Lines changed: 0 additions & 36 deletions
This file was deleted.

spec/0.8/components/legacy_views/action_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
it 'should work on rails legacy views' do
77
visit 'legacy_views/action_custom_component'
8+
89
expect(page).to have_content('Action Custom Component')
910
expect(page).not_to have_content('Action was successful')
1011
expect(page).not_to have_content('Action has failed')
@@ -19,4 +20,4 @@
1920
expect(page).to have_content('Inline Action Component')
2021
end
2122

22-
end
23+
end

0 commit comments

Comments
 (0)