@@ -7,9 +7,69 @@ import { BrowserName } from '../../types/types.js';
77import bcd from '../../index.js' ;
88import { InternalSupportBlock } from '../../types/index.js' ;
99
10- import mirrorSupport from './mirror.js' ;
10+ import mirrorSupport , { isOSLimitation } from './mirror.js' ;
1111
1212describe ( 'mirror' , ( ) => {
13+ describe ( 'isOSLimitation' , ( ) => {
14+ it ( 'returns false for undefined notes' , ( ) => {
15+ assert . equal ( isOSLimitation ( undefined ) , false ) ;
16+ } ) ;
17+
18+ it ( 'returns true for OS limitation notes' , ( ) => {
19+ assert . equal (
20+ isOSLimitation ( 'Supported on ChromeOS, macOS, and Windows only.' ) ,
21+ true ,
22+ ) ;
23+ assert . equal (
24+ isOSLimitation ( 'Supported on Linux and Windows only.' ) ,
25+ true ,
26+ ) ;
27+ assert . equal ( isOSLimitation ( 'Supported on macOS only.' ) , true ) ;
28+ assert . equal ( isOSLimitation ( 'Not supported on Windows.' ) , true ) ;
29+ assert . equal ( isOSLimitation ( 'Not yet supported on macOS.' ) , true ) ;
30+ } ) ;
31+
32+ it ( 'returns false for non-OS-limitation notes' , ( ) => {
33+ assert . equal (
34+ isOSLimitation ( 'This feature requires a flag to be enabled.' ) ,
35+ false ,
36+ ) ;
37+ assert . equal (
38+ isOSLimitation ( 'Before version 70, this method always returned true.' ) ,
39+ false ,
40+ ) ;
41+ assert . equal (
42+ isOSLimitation ( 'Firefox 73 added support for this thing.' ) ,
43+ false ,
44+ ) ;
45+ } ) ;
46+
47+ it ( 'handles array of notes (returns true only if all match)' , ( ) => {
48+ assert . equal (
49+ isOSLimitation ( [
50+ 'Supported on ChromeOS, macOS, and Windows only.' ,
51+ 'Not yet supported on Linux.' ,
52+ ] ) ,
53+ true ,
54+ ) ;
55+ assert . equal (
56+ isOSLimitation ( [
57+ 'Supported on ChromeOS, macOS, and Windows only.' ,
58+ 'This feature requires a flag.' ,
59+ ] ) ,
60+ false ,
61+ ) ;
62+ assert . equal (
63+ isOSLimitation ( [ 'This is a note.' , 'This is another note.' ] ) ,
64+ false ,
65+ ) ;
66+ } ) ;
67+
68+ it ( 'returns false for empty string' , ( ) => {
69+ assert . equal ( isOSLimitation ( '' ) , false ) ;
70+ } ) ;
71+ } ) ;
72+
1373 describe ( 'default export' , ( ) => {
1474 describe ( 'version numbers match expected values' , ( ) => {
1575 const mappings : {
@@ -189,6 +249,38 @@ describe('mirror', () => {
189249 notes : 'This feature is only supported in ChromeOS, macOS and Linux.' ,
190250 } ) ;
191251 } ) ;
252+
253+ it ( 'OS-specific partial_implementation and notes are not mirrored' , ( ) => {
254+ const support = {
255+ chrome : {
256+ version_added : '134' ,
257+ partial_implementation : true ,
258+ notes : 'Supported on ChromeOS, macOS, and Windows only.' ,
259+ } ,
260+ } ;
261+
262+ const mirrored = mirrorSupport ( 'chrome_android' , support ) ;
263+ assert . deepEqual ( mirrored , {
264+ version_added : '134' ,
265+ } ) ;
266+ } ) ;
267+
268+ it ( 'Non-OS-specific partial_implementation and notes are still mirrored' , ( ) => {
269+ const support = {
270+ chrome : {
271+ version_added : '70' ,
272+ partial_implementation : true ,
273+ notes : 'This feature is incomplete and may not work as expected.' ,
274+ } ,
275+ } ;
276+
277+ const mirrored = mirrorSupport ( 'chrome_android' , support ) ;
278+ assert . deepEqual ( mirrored , {
279+ version_added : '70' ,
280+ partial_implementation : true ,
281+ notes : 'This feature is incomplete and may not work as expected.' ,
282+ } ) ;
283+ } ) ;
192284 } ) ;
193285
194286 describe ( 'Validations' , ( ) => {
0 commit comments