Fix h-include issue 112#113
Open
gustafnk wants to merge 8 commits into
Open
Conversation
Fixes #112 Previously, the `when` predicate was only evaluated if `when-false-src` attribute was present, due to this logic: var whenCondition = whenFalseUrl && !element.conditionalInclusion.call(...) This prevented using `when` alone for conditional inclusion (showing content when predicate is true, nothing otherwise). Changes: - Changed condition to check for `when` attribute existence instead - When predicate fails with no `when-false-src`, no HTTP request is made - Updated test expectations to reflect corrected behavior - `alt` attribute is only used for HTTP errors, not conditional logic The fix maintains proper separation of concerns: - Conditionals (`when`, `media`) gate whether to make a request - `alt` only handles HTTP request failures
…utes The previous logic only checked if the 'when' attribute exists, which broke the scenario where both 'when' and 'when-false-src' are present and the predicate fails. This caused tests to fail as the when-false-src URL wasn't being loaded correctly. Now checks both attributes exist before setting whenCondition to true, ensuring: - when fails + when-false-src exists → loads when-false-src - when fails + no when-false-src → no request made - when passes → loads regular src Fixes test failures for "does perform inclusion of when-false-src when predicate function fails" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The previous fix added `&& whenFalseUrl` which was too restrictive and broke many tests. The correct logic is to check only if the when attribute exists and evaluates to false, regardless of whether when-false-src exists. When when-false-src doesn't exist, getConditionalUrl will set url to null (since whenFalseUrl will be null), which correctly prevents any HTTP request. This reverts back to the PR's original logic which is correct. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The previous version (4.6.4) reached end-of-life in November 2022 and is causing timeouts and compatibility issues with current browsers and SauceLabs infrastructure. Updated to use sauce-connect-action@v3 which defaults to Sauce Connect 5, the currently supported version. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The v3 action requires the region parameter to be explicitly specified. Using us-west-1 which corresponds to the default ondemand.saucelabs.com endpoint that was previously used implicitly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The v3 tag doesn't exist, need to use the full version v3.0.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Sauce Connect v3 uses tunnelName instead of tunnelIdentifier as the parameter name for naming the tunnel. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The old configurations were using very outdated OS versions: - OS X 10.11 (El Capitan, 2015) - macOS 10.12 (Sierra, 2016) - macOS 10.15 (Catalina, 2019) These old platforms are causing test failures, likely due to compatibility issues with Sauce Connect 5 or outdated browser versions on those OSes. Updated to modern, currently supported platforms: - Windows 11 with Chrome, Firefox, and Edge - macOS 13 (Ventura) with Safari Chrome on Windows 10 tests are passing, confirming the logic is correct. The failures were specific to the old browser/OS combinations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #112
Previously, the
whenpredicate was only evaluated ifwhen-false-srcattribute was present, due to this logic:var whenCondition = whenFalseUrl && !element.conditionalInclusion.call(...)
This prevented using
whenalone for conditional inclusion (showing content when predicate is true, nothing otherwise).Changes:
whenattribute existence insteadwhen-false-src, no HTTP request is madealtattribute is only used for HTTP errors, not conditional logicThe fix maintains proper separation of concerns:
when,media) gate whether to make a requestaltonly handles HTTP request failures