...you want to overwrite inherited methods but call the parent's implementation, too. In JavaScript, there is no simple "super" method like in Ruby -- so here is how to do...
...BaseClass to run as well -- and if you want to call a method in JavaScript, you need to do exactly that. Backbone offers a shortcut that is not too ugly...
...production, non-parallel test run. super end end def fresh? # Stock Webpacker checks if JavaScript changed in app, yarn.lock or config/webpack. # We want to be a bit stricter about freshness...
...assets once before your end-to-end integration test suite. Otherwise the first rendered javascript_pack_tag would start compilation, causing the helper to freeze for a minute and current...
...even easier. If you need IE8 support, keep using Bootstrap 3. Rewrote all our JavaScript plugins. Every plugin has been rewritten in ES6 to take advantage of the newest JavaScript...
# when the browser has no focus. When /^I unfocus the "(.*?)" field to trigger javascript listeners$/ do |field_label| field = page.find_field(field_label) # Firing 'autocomplete:done' is a workaround...
field = $('#{field[:id]}') field.blur() field.fire('autocomplete:done') JS sleep 1 end In the javascript: /* * Listening on "blur" events does not work in tests because Firefox has a bug * deferring...
end Short explanation: asset_host is used for links to stylesheets and javascripts asset_host belongs to ActionController::Base -- changes are persistent and will not be reset after...
...because we cannot yield out of define_method module InstanceMethods private # Force URLs for JavaScript and Stylesheet links def assets_have_urls old_asset_host = asset_host self.asset_host = HOST...
...to the lack of support. To solve this, you will need to introduce some JavaScript. In earlier Firefox versions, adding an inline ondragstart="false"-handler was enough to bypass the...
You are not using javascript tests The file is served from a public folder (not via controller) Problem description If you deliver files from a public folder it might...
...response with content-type "..." Outline How to test file downloads with tests that need javascript. Public served Look at the link of the url and check if this file exists...
...User-definable order of items Complicated item elements with super-custom CSS and other Javascript functionality Items that can be both leaves and containers of other items has_ancestry on...
...ended up using only draggable and reimplement something like droppable in ~120 lines of Javascript. There is some drag'n'drop support in Capybara/Selenium nodes, but again it's not...
...content of $('#id'). To do the same in Rails 3, include usual rails-ujs JavaScript, and put this into your application.js: $(function() { $('[data-remote][data-replace]') .data('type', 'html')
...replaced event on the link. .unobtrusive version In case you are using our unobtrusive JavaScript helper, use the following code instead: $.unobtrusive(function() { $('[data-remote][data-replace]') .data('type', 'html...
...position receives the click A step which finds and clicks the desired link via javascript may solve the problem: When(/^I search and click on "([^"]*)"$/) do |text| page.execute_script("$(\":contains...
...text}'):not(:has(:contains('#{text}')))\").click()") end Note: "Clicking" via JavaScript might click elements which are actually not clickable, e.g. because a modal overlay covers them. Use with caution.
You can also tell Unpoly to treat that one link as a vanilla Javascript link...
...page may load without assets. The dev server will detect any changes to your JavaScript and CSS and re-compile automatically. When it is done automatically any browser window showing...
...have a dev server running and call any helper that accesses asset paths (e.g. javascript_pack_tag or image_tag), Rails will compile your entire assets within its process before...
scope.paragraphs = _.map paragraphs, (lines) -> lines.split('\n') Also see simple_format helper for Javascript...
...use ES6 modules and npm packages (through Yarn). Webpacker is a wrapper around a JavaScript project called webpack. Yarn Yarn is the package manager we use for JavaScript. It does...
...for JavaScript roughly what Bundler does for Ruby. Read the first couple of sections of its official documentation. You should learn how to: Install and update packages Remove packages
...opacity': 1, 'margin-top': 0 }, { duration: 500 }); } The animation is implemented using setInterval and Javascript. This works great, but it's not as smooth as a CSS transition. Fortunately the...
...as a drop-in replacement for animate, but animate using CSS transitions instead of Javascript. This gives you a much higher framerate. If Transit has too many bells and whistles...
I had to deal with JavaScript Undefined Error while accessing a specific CKEditor instance to fill in text. Ensure everything is loaded with patiently do page.execute_script("return isCkeditorLoaded('#{selector...
...selector}');").should be_true end html.gsub!(/\n+/, "") # otherwise: unterminated string literal (Selenium::WebDriver::Error::JavascriptError) page.execute_script("CKEDITOR.instances['#{selector}'].setData('#{html}');") end The snippet for JavaScript: function isCkeditorLoaded(instance_selector...
...page, and have Selenium click it: path = "/your/path/here" id = "helper_#{SecureRandom.hex(8)}" execute_script <<-JAVASCRIPT var $helper = $(' ').attr({ href: #{path.to_json}, id: #{id.to_json}, target: '_blank' }); $helper.prependTo('body').text('click...
...me').css({ zIndex: 9999, position: 'absolute' }); setTimeout(function() { $helper.remove() }, 1000); JAVASCRIPT find("##{id}").click Note that the link tag is removed after 1 second. You may or may not want...
Old release code Old tmp folders with compiled view templates etc. Precompiled assets (Javascripts, images...) that no longer exist. When using the asset pipeline, Capistrano will symlink the public/assets...
...use Semantic Versioning's naming convention. If your library has both a Ruby and JavaScript component and you want to use the same version constant for both, you can use...
...some kind of pre-processing. You could probably also hack together a solution in JavaScript which downloads the background image file, rewrites the XML string and generates a data: URI...
Some modern Javascript APIs return iterators instead of arrays. In plain Javascript you can loop through an iterator using for...of: var iterator = ...; for (var value of iterator) { console.log(value...
...or close the dialog. The easiest way to interact with the editor is via javascript postMessages. To abort the dialog a post message on click with an event listener like...
...commit messages, add a new link "Commit" to your bookmarks and use the following Javascript as the link URL: javascript:(function() { let storyTitles = []; let stories = Array.from(document.querySelectorAll('.story[data-selected...
The asset pipeline is one of Rails' two mechanisms how stylesheets, javascripts and images from your /assets folder are processed and delivered to the browser. Rails has a second pipeline...
...reload your page. It will probably show an exception or have broken stylesheets or Javascript. Try to get everything working again. You will need rake assets:precompile.