Cucumber scenarios that are tagged with @javascript so they run with Selenium are very slow. You might not want to run them every time. In order to skip all Selenium...

...scenarios, call Cucumber like this: cucumber --tags ~@javascript Note that you should still run all the scenarios, including the Selenium ones, before you push a change...

You might sometimes use self to capture the context of this before it is destroyed by some function. Unfortunately self...

When I enter "text" into the browser dialog Also see Accept or deny JavaScript confirmation dialogs in Capybara/Selenium...

...how to do it without a server-side component (like a Rails application). Use JavaScript's navigator.language (real browsers and IE11+) and navigator.userLanguage (old IEs). Use a refresh as fallback...

...Provide buttons for paranoid users that disabled JavaScript and meta refreshs. JavaScript The following JavaScript will try to auto-detect a user's preferred language. It understands strings like like...

...universal method present? which returns true for all values that are not blank?. In JavaScript you need to roll your own implementation of blank? and present?. If your application uses...

...console.log(up.util.isBlank(foo)) // prints false console.log(up.util.isBlank(bar)) // prints true Testing for missing values JavaScript has both undefined or null to represent a missing value. Although there used to be...

...forms against concurrent edits This is from a real project: When opening a form, JavaScript makes a request to acquire a lock for that record (1). After 20 seconds the...

...JavaScript starts polling the server (2), to check if another user has taken the lock away from us by force. When the PC was low on resources (parallel_tests), acquiring...

blog.bitcrowd.net

When cucumber encounters a failing step in a @javascript feature, the selenium browser window instantly closes. Sometimes you do not want that, because you need to see what is going...

...flight AJAX requests to finish before ending a scenario: You may have client-side JavaScript that freaks out when the tab closure kills their pending requests. If that JavaScript opens...

end Legacy solution for jQuery frontends The module above is compatible with all JavaScript frameworks (or VanillaJS). If you cannot use capybara-lockstep and you're working on an...

medium.com

...parse, interpret & run them. In this post, we’ll dive into this phase for JavaScript, why it might be slowing down your app’s start-up & how you can fix...

Ask before leaving an unsaved CKEditor Vanilla JavaScript way, but removes any other onbeforeunload handlers: $(function(){ document.body.onbeforeunload = function() { for(editorName in CKEDITOR.instances) { if (CKEDITOR.instances[editorName].checkDirty()) { return "Unsaved changes present...

makandra dev
blog.getbootstrap.com

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

Accessing pseudo elements via JavaScript or jQuery is often painful/impossible. However, accessing their styles is fairly simple. Using getComputedStyle First, find the element in question. let element = document.querySelector('.my-element...

...or $('.my-element').get(0) when using jQuery Next, use JavaScript's getComputedStyle. It takes an optional 2nd argument to filter for pseudo elements. let style = window.getComputedStyle(element, '::before')

en.wikipedia.org

Under the same origin policy, a web page served from server1.example.com cannot normally connect to or communicate with a server...

Jasmine has spyOnProperty(), but it only works if the property is implemented using getter and setter functions. This is a...

coffeescript.org

The Javascript in operator does what Hash#has_key? does in Ruby: Return whether an object has a property. However, Coffeescript has its own in operator that checks for array...

...inclusion. To check whether an object has a property, use of: Javascript 'name' in {name: 'Horst'} # => true Coffeescript # wrong 'name' in {name: 'Horst'} # => false # correct 'name' of {name: 'Horst'} # => true...

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

rails-assets.org

Automatically builds gems from Bower packages (currently 1700 gems available). Packaged Javascript files are then automatically available in your asset pipeline manifests. Why we're not using it

...choice to use bower-rails instead. While we believe Rubygems/Bundler to be superior to Javascript package managers, we wanted to use something with enough community momentum behind it that it...

benmccormick.org

...of techniques that were best practices with ES5, but have better alternatives in modern JavaScript. Best practices don’t last forever. This is especially true when a field is changing...

...fast, and JavaScript development has changed a lot over the past 10 years. The old best practices go stale, and new ones take their place. Here are 5 JavaScript best...

...t been written down in this deck before, here it goes: When working with JavaScript Event objects, the DOM element that triggered the event is attached to them. [1]

Promises are the new way™ to express "Do this, and once you're done, do that". In contrast to callbacks...

There is no way to do it. This behavior is by design. You lose.

...non-breaking spaces or hyphens of various lengths. For this, use the ways below. Javascript, Coffeescript Use the \u escape sequence: note = '\u266A' You can use Unicode escape sequences in...

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

Then I should see an error These step definitions will not work for @javascript scenarios using the selenium web-driver @allow-rescue @javascript Scenario: Accessing the admin area requires...