Skip to content

Commit cb8d84b

Browse files
committed
fix(slider): make implicit dependency on sp-slider-handle explicit
1 parent f20448c commit cb8d84b

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

packages/slider/sp-slider.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
99
OF ANY KIND, either express or implied. See the License for the specific language
1010
governing permissions and limitations under the License.
1111
*/
12+
import './sp-slider-handle.js'; // codify sp-slider's implicit dependency on sp-slider-handle
1213
import { Slider } from './src/Slider.js';
1314

1415
customElements.define('sp-slider', Slider);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
Copyright 2021 Adobe. All rights reserved.
3+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License. You may obtain a copy
5+
of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
7+
Unless required by applicable law or agreed to in writing, software distributed under
8+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
OF ANY KIND, either express or implied. See the License for the specific language
10+
governing permissions and limitations under the License.
11+
*/
12+
13+
import { expect, fixture, html } from '@open-wc/testing';
14+
import '../sp-slider.js';
15+
import { Slider } from '../src/Slider.js';
16+
17+
describe('Slider - upgrade order', () => {
18+
it('loads both handles when document imports sp-slider-handle after sp-slider', async () => {
19+
const el = await fixture<Slider>(html`
20+
<sp-slider variant="range" step="1" min="0" max="255">
21+
Output Levels
22+
<sp-slider-handle
23+
slot="handle"
24+
name="min"
25+
label="Minimum"
26+
value="5"
27+
></sp-slider-handle>
28+
<sp-slider-handle
29+
slot="handle"
30+
name="max"
31+
label="Maximum"
32+
value="250"
33+
></sp-slider-handle>
34+
</sp-slider>
35+
`);
36+
37+
import('../sp-slider-handle.js');
38+
39+
const handles = el.shadowRoot.querySelectorAll('.handle');
40+
expect(handles).to.have.lengthOf(2);
41+
});
42+
});

0 commit comments

Comments
 (0)