Skip to content

Commit 8d7f1e5

Browse files
authored
Merge pull request #499 from matestack/next_release
1.3.1 Release
2 parents dbcd409 + 77e96ad commit 8d7f1e5

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v1.3.1 Release
4+
5+
### Bugfixes
6+
7+
- Fixes #497 Cable component throws browser error when initial content contains form component
8+
39
## v1.3.0 Release
410

511
### Potential breaking change
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%component{dynamic_tag_attributes.merge('initial-template': "#{render_content}")}
1+
%component{dynamic_tag_attributes.merge('v-bind:initial-template': "#{render_content.to_json}")}
22
%div{class: "matestack-cable-component-container", "v-bind:class": "{ 'loading': loading === true }"}
33
%div{class: "matestack-cable-component-wrapper", "v-if": "cableTemplate != null", "v-bind:class": "{ 'loading': loading === true }"}
44
%v-runtime-template{":template":"cableTemplate"}

lib/matestack/ui/core/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Matestack
22
module Ui
33
module Core
4-
VERSION = '1.3.0'
4+
VERSION = '1.3.1'
55
end
66
end
77
end

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matestack-ui-core",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"main": "app/javascript/matestack-ui-core",
55
"private": true,
66
"dependencies": {

spec/test/components/dynamic/cable/cable_spec.rb

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
include Utils
55
include Matestack::Ui::Core::ApplicationHelper
66

7+
before :each do
8+
9+
end
10+
711
it 'should have the typical matestack wrapping classes' do
812
matestack_render do
913
cable id: 'foobar' do
@@ -42,7 +46,7 @@
4246
expect(page).to have_selector('h1#id', text: 'replaced')
4347
reset_matestack_app
4448
end
45-
49+
4650
it 'should be possible to add vue.js components' do
4751
matestack_render do
4852
cable id: 'cable-replace', replace_on: 'replace' do
@@ -67,4 +71,46 @@
6771
expect(page).to have_content('event successful emitted')
6872
end
6973

74+
it 'should render Vue.js components and forms without Vue.js console error' do
75+
# unfortunately I can't test this as I'm not getting the browsers console.log via capybara/Selenium
76+
# tried all hints found on Stackoverflow etc
77+
matestack_render do
78+
cable id: 'cable-replace', replace_on: 'replace' do
79+
form for: :some_object, path: "/", method: :post do
80+
form_input key: :foo, type: :text, label: :foo, id: :foo
81+
end
82+
end
83+
end
84+
85+
# this was throwing a console error in v.1.3.0
86+
# "Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. For example, instead of <div id="{{ val }}">, use <div :id="val">."
87+
# fixed in v.1.3.1 without explicitly testing it...
88+
89+
expect(page).to have_selector('form')
90+
expect(page).to have_selector('input#foo')
91+
end
92+
93+
it 'should work without any initial body given' do
94+
matestack_render do
95+
cable id: 'cable-replace', replace_on: 'replace' do
96+
# nothing
97+
end
98+
toggle show_on: 'test' do
99+
plain 'event successful emitted'
100+
end
101+
end
102+
103+
expect(page).not_to have_content('event successful emitted')
104+
105+
onclick = matestack_component(:onclick, emit: :test) { button text: 'Click' }
106+
script = "MatestackUiCore.matestackEventHub.$emit('replace', { data: \"#{onclick}\" })".gsub("\n", "")
107+
page.execute_script(script)
108+
109+
expect(page).to have_selector('button', text: 'Click')
110+
expect(page).not_to have_content('event successful emitted')
111+
112+
click_on 'Click'
113+
expect(page).to have_content('event successful emitted')
114+
end
115+
70116
end

0 commit comments

Comments
 (0)