@@ 147-175 (lines=29) @@ | ||
144 | expect(query.jq('#wrapper').text()).toBe('Mister Johnson'); |
|
145 | }); |
|
146 | ||
147 | test('Bind a node to a component with item', () => { |
|
148 | document.body.innerHTML = `<div id="wrapper"><span id="username"></span></div>`; |
|
149 | ||
150 | const bindCommand = { |
|
151 | name: 'node.bind', |
|
152 | args: { |
|
153 | id: 'username', |
|
154 | component: { |
|
155 | name: 'Component', |
|
156 | item: 'item', |
|
157 | }, |
|
158 | }, |
|
159 | }; |
|
160 | const assignCommand = { |
|
161 | name: 'node.assign', |
|
162 | args: { |
|
163 | attr: 'innerHTML', |
|
164 | value: 'Mister Johnson', |
|
165 | }, |
|
166 | component: { |
|
167 | name: 'Component', |
|
168 | item: 'item', |
|
169 | }, |
|
170 | }; |
|
171 | ||
172 | handler.processCommands(makeRequest([bindCommand, assignCommand])); |
|
173 | ||
174 | expect(query.jq('#wrapper').text()).toBe('Mister Johnson'); |
|
175 | }); |
|
176 | ||
177 | test('Assign a component not bound to a node', () => { |
|
178 | document.body.innerHTML = `<div id="wrapper"><span jxn-bind="Component" jxn-item="item"></span></div>`; |
|
@@ 118-145 (lines=28) @@ | ||
115 | expect(query.jq('#wrapper').text()).toBe('Mister Johnson'); |
|
116 | }); |
|
117 | ||
118 | test('Bind a node to a component with empty item', () => { |
|
119 | document.body.innerHTML = `<div id="wrapper"><span id="username"></span></div>`; |
|
120 | ||
121 | const bindCommand = { |
|
122 | name: 'node.bind', |
|
123 | args: { |
|
124 | id: 'username', |
|
125 | component: { |
|
126 | name: 'Component', |
|
127 | item: '', |
|
128 | }, |
|
129 | }, |
|
130 | }; |
|
131 | const assignCommand = { |
|
132 | name: 'node.assign', |
|
133 | args: { |
|
134 | attr: 'innerHTML', |
|
135 | value: 'Mister Johnson', |
|
136 | }, |
|
137 | component: { |
|
138 | name: 'Component', |
|
139 | }, |
|
140 | }; |
|
141 | ||
142 | handler.processCommands(makeRequest([bindCommand, assignCommand])); |
|
143 | ||
144 | expect(query.jq('#wrapper').text()).toBe('Mister Johnson'); |
|
145 | }); |
|
146 | ||
147 | test('Bind a node to a component with item', () => { |
|
148 | document.body.innerHTML = `<div id="wrapper"><span id="username"></span></div>`; |
|
@@ 90-116 (lines=27) @@ | ||
87 | expect(query.jq('#wrapper').text()).toBe('Mister Johnson'); |
|
88 | }); |
|
89 | ||
90 | test('Bind a node to a component', () => { |
|
91 | document.body.innerHTML = `<div id="wrapper"><span id="username"></span></div>`; |
|
92 | ||
93 | const bindCommand = { |
|
94 | name: 'node.bind', |
|
95 | args: { |
|
96 | id: 'username', |
|
97 | component: { |
|
98 | name: 'Component', |
|
99 | }, |
|
100 | }, |
|
101 | }; |
|
102 | const assignCommand = { |
|
103 | name: 'node.assign', |
|
104 | args: { |
|
105 | attr: 'innerHTML', |
|
106 | value: 'Mister Johnson', |
|
107 | }, |
|
108 | component: { |
|
109 | name: 'Component', |
|
110 | }, |
|
111 | }; |
|
112 | ||
113 | handler.processCommands(makeRequest([bindCommand, assignCommand])); |
|
114 | ||
115 | expect(query.jq('#wrapper').text()).toBe('Mister Johnson'); |
|
116 | }); |
|
117 | ||
118 | test('Bind a node to a component with empty item', () => { |
|
119 | document.body.innerHTML = `<div id="wrapper"><span id="username"></span></div>`; |