WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
ASSIGNED
218357
Web Inspector: Unit test insertion of interactive tokens for CSS values
https://bugs.webkit.org/show_bug.cgi?id=218357
Summary
Web Inspector: Unit test insertion of interactive tokens for CSS values
Nikita Vasilyev
Reported
2020-10-29 14:55:03 PDT
While working on
Bug 218295
: Web Inspector: Extra closing parenthesis added after var in styles panel, I realized that the logic to insert special tokens is untested. Here's the list of methods that insert interactive tokens: _addVariableTokens _addBoxShadowTokens _addGradientTokens _addColorTokens _addTimingFunctionTokens Currently, it's non-trivial to test this because it would involve simulating starting editing of a CSS value (e.g. by clicking on it). Here's my plan how to unit test this. Currently, the methods mentioned above take an array of CodeMirror tokens (produced by WI.tokenizeCSSValue) and insert HTML elements in that list (such as inline swatches for color and go-to arrows for variables). Here's a real-world example of this: [ {value: "calc", type: "atom m-css"}, {value: "(", type: null}, {value: "var", type: "atom m-css"}, {value: "(", type: null}, {value: "--x", type: "variable-2 m-css"}, <button class="go-to-arrow select-variable-property" title="Go to variable"></button>, // <- Inserted DOM element {value: ")", type: null}, {value: " ", type: null}, {value: "+", type: null}, {value: "1px", type: "number m-css"}, {value: ")", type: null} ] I propose: 1. Move _add*Tokens functions away from Views/SpreadsheetStyleProperty.js to CodeMirrorAdditions.js. That would place them next to the relevant WI.tokenizeCSSValue method. However, I'm open to suggestions. 2. Change _add*Tokens function so they don't insert DOM elements in the list. Instead, they will insert new kind of tokens, such as `{value: "", specialType: "select-variable-property"}. 3. SpreadsheetStyleProperty.js will transform these new tokens into appropriate DOM element. This would allow us to unit test _add*Tokens functions' input/output without interacting with DOM.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-10-29 14:55:29 PDT
<
rdar://problem/70826918
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug