File tree Expand file tree Collapse file tree 4 files changed +77
-5
lines changed
Expand file tree Collapse file tree 4 files changed +77
-5
lines changed Original file line number Diff line number Diff line change 1+ import * as React from "react" ;
2+
3+ import { Meta , StoryFn } from "@storybook/react" ;
4+
5+ import { MethodModeling as MethodModelingComponent } from "../../view/method-modeling/MethodModeling" ;
6+ export default {
7+ title : "Method Modeling/Method Modeling" ,
8+ component : MethodModelingComponent ,
9+ } as Meta < typeof MethodModelingComponent > ;
10+
11+ const Template : StoryFn < typeof MethodModelingComponent > = ( args ) => (
12+ < MethodModelingComponent { ...args } />
13+ ) ;
14+
15+ export const MethodUnmodeled = Template . bind ( { } ) ;
16+ MethodUnmodeled . args = { modelingStatus : "unmodeled" } ;
17+
18+ export const MethodModeled = Template . bind ( { } ) ;
19+ MethodModeled . args = { modelingStatus : "unsaved" } ;
20+
21+ export const MethodSaved = Template . bind ( { } ) ;
22+ MethodSaved . args = { modelingStatus : "saved" } ;
Original file line number Diff line number Diff line change 11import * as React from "react" ;
2+ import { styled } from "styled-components" ;
3+ import {
4+ ModelingStatus ,
5+ ModelingStatusIndicator ,
6+ } from "../model-editor/ModelingStatusIndicator" ;
27
3- export const MethodModeling = ( ) : JSX . Element => {
8+ const Container = styled . div `
9+ background-color: var(--vscode-peekViewResult-background);
10+ padding: 0.3rem;
11+ margin-bottom: 1rem;
12+ ` ;
13+
14+ const Title = styled . div `
15+ padding-bottom: 0.3rem;
16+ font-size: 1.2em;
17+ ` ;
18+
19+ const DependencyContainer = styled . div `
20+ display: flex;
21+ justify-content: space-between;
22+ ` ;
23+
24+ const DependencyName = styled . span `
25+ font-family: var(--vscode-editor-font-family);
26+ ` ;
27+
28+ export type MethodModelingProps = {
29+ modelingStatus : ModelingStatus ;
30+ } ;
31+
32+ export const MethodModeling = ( props : MethodModelingProps ) => {
33+ const { modelingStatus } = props ;
434 return (
5- < >
6- < p > Hello</ p >
7- </ >
35+ < Container >
36+ < Title > API or Method</ Title >
37+ < DependencyContainer >
38+ < DependencyName > that.dependency.THENAME</ DependencyName >
39+ < ModelingStatusIndicator status = { modelingStatus } />
40+ </ DependencyContainer >
41+ </ Container >
842 ) ;
943} ;
Original file line number Diff line number Diff line change 11import * as React from "react" ;
22import { useEffect } from "react" ;
33import { MethodModeling } from "./MethodModeling" ;
4+ import { ModelingStatus } from "../model-editor/ModelingStatusIndicator" ;
45
56export function MethodModelingView ( ) : JSX . Element {
67 useEffect ( ( ) => {
@@ -20,5 +21,6 @@ export function MethodModelingView(): JSX.Element {
2021 } ;
2122 } , [ ] ) ;
2223
23- return < MethodModeling /> ;
24+ const modelingStatus : ModelingStatus = "saved" ;
25+ return < MethodModeling modelingStatus = { modelingStatus } /> ;
2426}
Original file line number Diff line number Diff line change 1+ import * as React from "react" ;
2+ import { render as reactRender , screen } from "@testing-library/react" ;
3+ import { MethodModeling , MethodModelingProps } from "../MethodModeling" ;
4+
5+ describe ( MethodModeling . name , ( ) => {
6+ const render = ( props : MethodModelingProps ) =>
7+ reactRender ( < MethodModeling { ...props } /> ) ;
8+
9+ it ( "renders method name" , ( ) => {
10+ render ( { modelingStatus : "saved" } ) ;
11+
12+ expect ( screen . getByText ( "that.dependency.THENAME" ) ) . toBeInTheDocument ( ) ;
13+ } ) ;
14+ } ) ;
You can’t perform that action at this time.
0 commit comments