- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.1k
fix: LEAP-1892: [FE] Deeply nested Choices are visible when their parents are hidden #7180
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            13 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      7cdd89e
              
                fix: LEAP-1892: [FE] Deeply nested Choices are visible when their par…
              
              
                nass600 435eccc
              
                Added integration tests
              
              
                nass600 31baf75
              
                Linting fixes
              
              
                nass600 1fcb092
              
                Merge branch 'develop' into 'fb-leap-1892/deeply-nested-choices'
              
              
                nass600 fed93f1
              
                Expanding tests to cover more cases
              
              
                nass600 219ffcd
              
                Merge branch 'develop' into 'fb-leap-1892/deeply-nested-choices'
              
              
                nass600 88b8841
              
                Adding tests for perregion cases
              
              
                nass600 65369ca
              
                Leaving perregion use cases out of the scope of this bug
              
              
                nass600 2cae947
              
                Linting fixes
              
              
                nass600 0125db9
              
                Improved tests and remove from scope choice-unselected
              
              
                nass600 f24f9bd
              
                Reducing the scope of the changes to avoid risk
              
              
                nass600 db76ad7
              
                Merge branch 'develop' into 'fb-leap-1892/deeply-nested-choices'
              
              
                MihajloHoma d41921a
              
                Sync Follow Merge dependencies
              
              
                robot-ci-heartex File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
        
          
  
    
      
          
            245 changes: 245 additions & 0 deletions
          
          245 
        
  web/libs/editor/tests/integration/data/control_tags/visibility.ts
  
  
      
      
   
        
      
      
    
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,245 @@ | ||
| export const simpleVisibleWhenVisibilityConfig = `<View> | ||
| <Text name="text" value="$text"/> | ||
|  | ||
| <View name="Level 1"> | ||
| <Header value="Level 1"/> | ||
| <Choices name="level1" toName="text" choice="single" showInLine="true"> | ||
| <Choice value="1A"/> | ||
| <Choice value="1B"/> | ||
| </Choices> | ||
| </View> | ||
|  | ||
| <Choices | ||
| name="level2" toName="text" choice="single" showInLine="true" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level1" | ||
| whenChoiceValue="1A" | ||
| > | ||
| <Choice value="2A"/> | ||
| <Choice value="2B"/> | ||
| </Choices> | ||
|  | ||
| <Choices | ||
| name="level3" toName="text" choice="single" showInLine="true" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level2" | ||
| whenChoiceValue="2A" | ||
| > | ||
| <Choice value="3A"/> | ||
| <Choice value="3B"/> | ||
| </Choices> | ||
| </View>`; | ||
|  | ||
| export const multipleChainedViewsVisibilityConfig = `<View> | ||
| <Text name="text" value="$text"/> | ||
|  | ||
| <View name="Level 1"> | ||
| <Header value="Level 1"/> | ||
| <Choices name="level1" toName="text" choice="single" showInLine="true"> | ||
| <Choice value="1A"/> | ||
| <Choice value="1B"/> | ||
| </Choices> | ||
| </View> | ||
|  | ||
| <!-- Level 2 --> | ||
| <View | ||
| name="Level 2" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level1" | ||
| whenChoiceValue="1A" | ||
| > | ||
| <Header value="Level 2"/> | ||
| <Choices name="level2" toName="text" choice="single" showInLine="true"> | ||
| <Choice value="2A"/> | ||
| <Choice value="2B"/> | ||
| </Choices> | ||
| </View> | ||
|  | ||
| <!-- Level 3A --> | ||
| <View | ||
| name="Level 3A" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level2" | ||
| whenChoiceValue="2A" | ||
| > | ||
| <Header value="Level 3A"/> | ||
| <Choices name="level3A" toName="text" choice="single" showInLine="true"> | ||
| <Choice value="3X"/> | ||
| <Choice value="3Y"/> | ||
| </Choices> | ||
| </View> | ||
|  | ||
| <!-- Level 3B --> | ||
| <View | ||
| name="Level 3B" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level2" | ||
| whenChoiceValue="2B" | ||
| > | ||
| <Header value="Level 3B"/> | ||
| <Choices name="level3B" toName="text" choice="single" showInLine="true"> | ||
| <Choice value="3Q"/> | ||
| <Choice value="3W"/> | ||
| </Choices> | ||
| </View> | ||
| </View>`; | ||
|  | ||
| export const simpleUnselectedVisibilityConfig = ` | ||
| <View> | ||
| <Text name="text" value="$text"/> | ||
|  | ||
| <Choices name="level1" toName="text" choice="single-radio" showInline="true" required="true"> | ||
| <Choice value="A" /> | ||
| <Choice value="B" /> | ||
| <Choice value="Other" /> | ||
| </Choices> | ||
| <View name="level2" visibleWhen="choice-selected" whenTagName="level1" whenChoiceValue="A,B"> | ||
| <Header value="Selected level"/> | ||
| <Choices name="selected-level" toName="text"> | ||
| <Choice value="1X"/> | ||
| </Choices> | ||
| </View> | ||
| <View name="level3" visibleWhen="choice-unselected" whenChoiceValue="Other" whenTagName="level1"> | ||
| <Header value="Unselected level"/> | ||
| <Choices name="unselected-level" toName="text"> | ||
| <Choice value="2X"/> | ||
| </Choices> | ||
| </View> | ||
| </View> | ||
| `; | ||
|  | ||
| export const textareaVisibilityConfig = ` | ||
| <View> | ||
| <Header value="Author"/> | ||
| <Text name="text" value="$text"/> | ||
| <Choices name="author" toName="text" required="false" maxUsages="1"> | ||
| <Choice value="choice1"/> | ||
| </Choices> | ||
|  | ||
| <View visibleWhen="choice-selected" whenTagName="author" whenChoiceValue="choice1"> | ||
| <Header value="New Author"/> | ||
| <TextArea name="new_author" toName="text" maxSubmissions="1"/> | ||
| </View> | ||
| </View> | ||
| `; | ||
|  | ||
| export const perRegionVisibilityConfig = ` | ||
| <View> | ||
| <Image name="image" value="$image"/> | ||
|  | ||
| <RectangleLabels name="label" toName="image"> | ||
| <Label value="Tumor" background="green"/> | ||
| </RectangleLabels> | ||
|  | ||
| <Choices name="classification" toName="image" perRegion="true"> | ||
| <Choice value="Benign"/> | ||
| <Choice value="Malignant"/> | ||
| <Choice value="Normal"/> | ||
| </Choices> | ||
| </View> | ||
| `; | ||
|  | ||
| export const perRegionVisibilityResult = [ | ||
| { | ||
| id: "Dx_aB91ISN", | ||
| source: "$image", | ||
| from_name: "label", | ||
| to_name: "image", | ||
| type: "rectanglelabels", | ||
| origin: "manual", | ||
| value: { | ||
| height: 20, | ||
| rotation: 0, | ||
| width: 20, | ||
| x: 40, | ||
| y: 40, | ||
| rectanglelabels: ["Tumor"], | ||
| }, | ||
| }, | ||
| ]; | ||
|  | ||
| export const perRegionConditionalVisibilityConfig = ` | ||
| <View> | ||
| <Image name="image" value="$image"/> | ||
| <Rectangle name="rect" toName="image" /> | ||
| <View visibleWhen="region-selected"> | ||
|  | ||
| <!-- Level 1 --> | ||
| <View name="Level 1"> | ||
| <Header value="Level 1"/> | ||
| <Choices perRegion="true" name="level1" toName="image" choice="single" showInLine="true"> | ||
| <Choice value="Start nesting choices"/> | ||
| <Choice value="Show nothing"/> | ||
| </Choices> | ||
| </View> | ||
|  | ||
| <!-- Level 2 under Safety and Compliance --> | ||
| <View name="Level 2 Safety and Compliance" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level1" | ||
| whenChoiceValue="Start nesting choices"> | ||
| <Header value="Level 2"/> | ||
| <Choices perRegion="true" name="level2_safety" toName="image" choice="single" showInLine="true" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level1" | ||
| whenChoiceValue="Start nesting choices"> | ||
| <Choice value="A"/> | ||
| <Choice value="B"/> | ||
| </Choices> | ||
| </View> | ||
| <!-- Level 3 under Documentation and Record Keeping --> | ||
| <View name="Level 3 Doc and Record" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level2_safety" | ||
| whenChoiceValue="A"> | ||
| <Header value="Level 3"/> | ||
| <Choices perRegion="true" name="level3_doc" toName="image" choice="single" showInLine="true" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level2_safety" | ||
| whenChoiceValue="A"> | ||
| <Choice value="X"/> | ||
| <Choice value="Y"/> | ||
| </Choices> | ||
| </View> | ||
| <!-- Level 3 under Training and Familiarization (under Safety and Compliance) --> | ||
| <View name="Level 3 Training" | ||
| visibleWhen="choice-selected" | ||
| whenTagName="level2_safety" | ||
| whenChoiceValue="B"> | ||
| <Header value="Level 3"/> | ||
| <Choices perRegion="true" name="level3_training" toName="image" choice="single" showInLine="true"> | ||
| <Choice value="Q"/> | ||
| <Choice value="W"/> | ||
| </Choices> | ||
| </View> | ||
| </View> | ||
| </View> | ||
| `; | ||
|  | ||
| export const perRegionConditionalVisibilityResult = [ | ||
| { | ||
| original_width: 600, | ||
| original_height: 403, | ||
| image_rotation: 0, | ||
| value: { | ||
| x: 22.72106824925816, | ||
| y: 47.18100890207715, | ||
| width: 21.126607319485665, | ||
| height: 31.157270029673583, | ||
| rotation: 0, | ||
| }, | ||
| id: "fgWSL6Nor_", | ||
| from_name: "rect", | ||
| to_name: "image", | ||
| type: "rectangle", | ||
| origin: "manual", | ||
| }, | ||
| ]; | ||
|  | ||
| export const visibilityTextData = { | ||
| text: "This text exists for no reason", | ||
| }; | ||
|  | ||
| export const visibilityImageData = { | ||
| image: "https://data.heartex.net/open-images/train_0/mini/00155094b7acc33b.jpg", | ||
| }; | 
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.