February 2019
Intermediate to advanced
240 pages
5h 25m
English
OK, let’s take this up a notch. Setting up testing with JavaScript support is not going to be so straightforward with Docker. But I think you’re ready to handle it.
Imagine, if you will, that we have an enhanced version of our /welcome page that has extra behavior that only works with JavaScript enabled. In fact, when functioning correctly, this JavaScript literally adds the message “ENHANCED!” on the page.
Here’s my rather crude implementation in app/views/welcome/index.html.erb:
| | <% content_for :head do %> |
| | <script type="text/javascript"> |
| | document.addEventListener("DOMContentLoaded",function(){ |
| | document.getElementsByTagName('h1')[0].append(' ENHANCED!'); |
| | }); |
| | </script> |
| | <% ... |
Read now
Unlock full access