# 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...

You can also tell Unpoly to treat that one link as a vanilla Javascript link...

makandra dev

...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...

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...

scope.paragraphs = _.map paragraphs, (lines) -> lines.split('\n') Also see simple_format helper for Javascript...

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...

...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

...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...

makandra dev

...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.

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...

makandra dev

...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...

...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...

...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...

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...

...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...

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...

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.

...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...

If you manipulate the DOM with JavaScript and your page contains nested elements with position: relative, chances are Internet Explorer 7 will not properly move to the right position.

...nest. This is often impossible, though. Force the correct redrawing of the elements using JavaScript. Adding a bogus class ($(element).addClass('touch')) seems to suffice. Try to give the offending...

...not it is hidden via CSS. In a Selenium scenario, visibility is detected via Javascript. This detection is very precise and should correctly determine visibility for the most fucked up...

...in your PT profile or in ~/.config/geordi/global.yml if you have ever used geordi commit javascript: (function() { var pt_project_id = 'XXX'; var pt_token='XXX'; var url = `https://www.pivotaltracker.com/services/v5/projects/$...

makandra dev

...browsers that support a given declaration. There is CSS.supports() to do the equivalent in Javascript. backdrop-filter (Edge 17+, but not FF): Applying filters to what is visible through an...