timemachine.js allows you to mock the client's time by monkey-patching into Javascript core classes. We use timemachine.js in combination with the Timecop gem to synchronize the local...
...we see that Timecop is mocking the time: - if defined?(Timecop) && Timecop.top_stack_item = javascript_include_tag "timemachine.js" :javascript timemachine.config({ dateString: #{Time.now.to_json}, tick: true }) Warning timemachine.js will mock the...
...language settings. For example, German users will see 1,23 for . Values in the JavaScript API or when submitting forms to the server will always use a point as decimal...
...the matchers fail. This helps when browser state changes between expectations, e.g. by async JavaScript that mutates the DOM tree while you're making multiple observations. Custom matchers must be...
...knowing what to look for. When coming from jQuery, also see the card on JavaScript without jQuery. This card includes a link to You Don't Need jQuery, which summarizes...
...most of the alternatives in native Javascript implementation to jQuery methods...
- uses: ./.github/actions/setup-ruby - name: Run RuboCop run: bundle exec rubocop --color eslint: name: Lint JavaScript Code runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-node - name: Run EsLint
...gem 'jsbundling-rails' group :development, :test do gem 'foreman' # ... end bundle install run bin/rails javascript:install:esbuild in a console to prepare esbuild. run yarn install to install all packages...
...assets:clobber to remove the precompiled assets again. adapt your stylesheet_link_tag and javascript_link_tag to match the new pack names. start the development server with the command...
extract_css: true 3. Change stylesheet_link_tag to stylesheet_pack_tag and javascript_include_tag to javascript_pack_tag 4. Replace image_tag with image_pack_tag if...
...the modules in other files, like the app/webpack/stylesheets/boostrap.sass imports the bootstrap stylesheet. For old Javascript libraries you need to expose jQuery to the window object. Here is an example how...
...to livereload-js match[1] end watch(%r(^app/assets/.*\.js$)) do |_match| # Any source Javascript changed. Assume the next changes in public/assets refer to JS. last_js_change = Time.now
port: 35729, } Finally, require this new entrypoint in your layout with - if Rails.env.development? = javascript_include_tag 'dev', nonce: true (skip the nonce, if you do not have a CSP...
...modernen Webapplikationen bestehen. Außerdem weißt du für was welcher Baustein da ist: HTML CSS Javascript (Browser, Frontend) "Backend" Applikation Du verstehst warum HTTP ein "stateless Protocol" ist.
...you understand "impossible" behavior of your tests. When you run a Rack::Test (non-Javascript) test with Capybara, there is a single process in play. It runs both your test...
...and the server responding to the user interactions scripted by your test. A Selenium (Javascript) test has a lot more moving parts: One process runs your test script. This is...
...app, browser: :chrome, options: options) end Before do Capybara.current_driver = :rack_test end Before('@javascript') do Capybara.current_driver = :selenium
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...
...scrolling. This frees the browser up to respond to scrolling immediately without waiting for JavaScript, thus ensuring a reliably smooth scrolling experience for the user. elem.addEventListener('touchstart', fn, { passive: true...
...are a simple animation framework that is built right into browsers. No need for Javascript here. They're supported by all browsers. Basic usage Transitions are used to animate the...
...are not written to input fields with fill_in. A workaround is to use javascript / jquery to change the contents of an input field. Use the following code or add...
...unknown reasons. field = find_field(locator) id = field[:id].presence if id execute_script <<~JAVASCRIPT var field = document.querySelector('##{id}'); field.value = #{text.to_json}; field.dispatchEvent(new Event('input')); field.dispatchEvent(new Event('change...
...focusable nor visible to screen readers. Alternatives If you're starting your transition from JavaScript, you can give the element the [inert] attribute. This will make the browser ignore input...
...security vulnerabilities. The dependencies of your apps are Ruby, Rails, all other gems and JavaScript libraries. Find out what a CVE advisory is. Understand how we're dealing with security...
Collection of useful tools in the Chrome JavaScript console. Make the whole page editable This is not special to Chrome, but still a clever thing: document.body.contentEditable=true Taking time
...markdown from user input, an attacker might be able to use this to inject javascript code into the source code of your page. The linked github page is a collection...
...common markdown XSS payloads which is handy for writing tests. Producing arbitrary links: [Basic](javascript:alert('Basic')) [Local Storage](javascript:alert(JSON.stringify(localStorage))) [CaseInsensitive](JaVaScRiPt:alert('CaseInsensitive')) [URL](javascript://www.google.com...
...query parameter ordering 1 URI ignoring query parameter ordering 2 Tests with AJAX Using javascript in integration tests might cause issues that AJAX requests are not recorded or bleed in...
...have many elements on our page. Clicking them should open a modal dialog. Vanilla JavaScript document.addEventListener('click', function(event) { if (event.target.closest('.dialog-link')) { // Open dialog } }); See Event delegation without jQuery...
...single-line texts. If you want to truncate tests across multiple lines, use a JavaScript solution like Superclamp. There is also -webkit-line-clamp which works only on Chrome.
...know about this. 0. Security considerations Each "like" button is implemented by including a Javascript on your site. This means you are running fucking remote code on your page. You...
...site is suggesting security by operating under HTTPS and you are still loading remote Javascript you are sort of full of shit. Even if you are cool with injecting remote...
Resources RubyGuides: Mastering Ruby Regular Expressions Using regular expressions in JavaScript Testing regular expressions visually Regular Expressions: Quantifier modes Ruby: You can nest regular expressions Matching line feeds with...