Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test are broken #34

Open
Zardoz89 opened this issue Sep 20, 2020 · 2 comments
Open

test are broken #34

Zardoz89 opened this issue Sep 20, 2020 · 2 comments

Comments

@Zardoz89
Copy link

I just try to run the automated tests and I get many errors. A weird thing its that shows "using HeadlessChrome/78". I have installed a more modern versión

npm run test


> [email protected] test XXXX/chosen
> grunt test

Running "coffee:jquery" (coffee) task
>> 1 files created.

Running "coffee:proto" (coffee) task
>> 1 files created.

Running "coffee:test" (coffee) task
>> 2 files created.

Running "jasmine:jquery" (jasmine) task

Testing specs with Jasmine/latest via HeadlessChrome/78.0.3882.0
 Events
   - chosen should fire the right events......X
     Expected $.length = 0 to equal 2.
Expected $[0] = undefined to equal 'input'.
Expected $[1] = undefined to equal 'change'. (1)
>> Expected $.length = 0 to equal 2.
>> Expected $[0] = undefined to equal 'input'.
>> Expected $[1] = undefined to equal 'change'. Error: Expected $.length = 0 to equal 2.
>> Expected $[0] = undefined to equal 'input'.
>> Expected $[1] = undefined to equal 'change'.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:131:37)
>>     at <Jasmine>
 search
   - should only show max_shown_results items in results......✓
   - should display only matching items when entering a search term......✓
 Searching
   - does not clear search text or highlight first suggestion when holding ctrl/cmd and selecting multiple items......X
     Expected 0 to be 1. (1)
>> Expected 0 to be 1. Error: Expected 0 to be 1.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:449:49)
>>     at <Jasmine>
     Expected 0 to be 2. (2)
>> Expected 0 to be 2. Error: Expected 0 to be 2.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:456:49)
>>     at <Jasmine>
   - matches in non-ascii languages like Chinese when selecting a single item with search_contains......✓
   - clears search text and highlights first suggestion without ctrl/cmd and selecting multiple items without hide_results_on_select......X
     Expected 0 to be 1. (1)
>> Expected 0 to be 1. Error: Expected 0 to be 1.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:490:49)
>>     at <Jasmine>
     Expected 's' to be ''. (2)
>> Expected 's' to be ''. Error: Expected 's' to be ''.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:491:34)
>>     at <Jasmine>
     Expected 'active-result' to contain 'highlighted'. (3)
>> Expected 'active-result' to contain 'highlighted'. Error: Expected 'active-result' to contain 'highlighted'.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:492:70)
>>     at <Jasmine>
   - matches in non-ascii languages like Chinese when selecting multiple items......✓
   respects word boundaries when not using search_contains
     - correctly finds words that start after a(n) leftquote......✓
     - correctly finds words that start after a(n) guillemet......✓
     - correctly finds words that start after a(n) lcurly......✓
     - correctly finds words that start after a(n) lbrace......✓
     - correctly finds words that start after a(n) upsidedownqmark......✓
     - correctly finds words that start after a(n) upsidedownbang......✓
     - correctly finds words that start after a(n) leftsinglequote......✓
     - correctly finds words that start after a(n) angledleftsinglequote......✓
     - correctly finds words that start after a(n) angledleftquote......✓
     - correctly finds words that start after a(n) langle......✓
     - correctly finds words that start after a(n) lparen......✓
     - correctly finds words that start after a(n) dash......✓
     - correctly finds words that start after a(n) period......✓
   - highlights results correctly when multiple words are present......✓
   - should not match the actual text of HTML entities......✓
   - renders options correctly when they contain characters that require HTML encoding......✓
   - renders no results message correctly when it contains characters that require HTML encoding......X
     Expected 'No results for: <span>&amp;</span>' to be 'No results match <span>&amp;</span>'. (1)
>> Expected 'No results for: <span>&amp;</span>' to be 'No results match <span>&amp;</span>'. Error: Expected 'No results for: <span>&amp;</span>' to be 'No results match <span>&amp;</span>'.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:262:61)
>>     at <Jasmine>
     Expected 'No results for: <span>&amp;amp;</span>' to be 'No results match <span>&amp;amp;</span>'. (2)
>> Expected 'No results for: <span>&amp;amp;</span>' to be 'No results match <span>&amp;amp;</span>'. Error: Expected 'No results for: <span>&amp;amp;</span>' to be 'No results match <span>&amp;amp;</span>'.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:266:68)
>>     at <Jasmine>
   - matches in non-ascii languages like Chinese when selecting a single item......✓
   - renders optgroups correctly when they contain html encoded tags......✓
   - renders optgroups correctly when they contain characters that require HTML encoding when searching......✓
   - matches in non-ascii languages like Chinese when selecting multiple items with search_contains......✓
 Bugfixes
   - https://github.com/harvesthq/chosen/issues/2996 - XSS Vulnerability with `include_group_label_in_selected: true`......X
     Expected '
  <span>Select an Option</span>
  <div><b></b></div>
' to contain '&lt;/script&gt;&lt;script&gt;console.log(1)&lt;/script&gt;'. (1)
>> Expected '
>>   <span>Select an Option</span>
>>   <div><b></b></div>
>> ' to contain '&lt;/script&gt;&lt;script&gt;console.log(1)&lt;/script&gt;'. Error: Expected '
>>   <span>Select an Option</span>
>>   <div><b></b></div>
>> ' to contain '&lt;/script&gt;&lt;script&gt;console.log(1)&lt;/script&gt;'.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:103:33)
>>     at <Jasmine>
 Basic setup
   data-placeholder
     - should render with special characters......✓
     - should render......✓
   disabled fieldset
     - should render as disabled......✓
   - should create very basic chosen......X
     Expected '' to be 'Afghanistan'. (1)
>> Expected '' to be 'Afghanistan'. Error: Expected '' to be 'Afghanistan'.
>>     at <Jasmine>
>>     at UserContext.<anonymous> (file://XXXX/chosen/spec/public/jquery_specs.js:26:35)
>>     at <Jasmine>
   - it should not render hidden options......✓
   - it should not render hidden optgroups......✓
   - should add chosen to jQuery object......✓

36 specs in 0.346s.
>> 6 failures
Warning: Task "jasmine:jquery" failed.� Use --force to continue.

Aborted due to warnings.

Misc info

Where I ran this had :

Ryzen 7 3700X with 16GiB
KUbuntu 20.04
nodejs : v12.13.1
npm: v6.14.8
Firefox: 80.0.1
Chrome: 85.0.4
Chromiun: 85.0.4
Chrome webdriver : 85.0.4

@Zardoz89
Copy link
Author

I keep trying a bit. I don't very sure, but looks that get jasmine + karma + chrome + coffescript working all on a nice way, its a little nightmare.

JJJ added a commit that referenced this issue May 20, 2021
JJJ added a commit that referenced this issue May 20, 2021
@JJJ
Copy link
Owner

JJJ commented May 20, 2021

I think the rest might be quick fixes, once we can figure out why some of the Events aren't firing.

For example:

container.find(".active-result").last().trigger("mouseup")

Selects the last Option in the Chosen UI, but then select.val() still reports back '' even though it looks like...

select.option[2].selected = true

In my live tests, outside of Jasmine, everything looks like it's working correctly. Weird!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants