@@ -874,4 +874,130 @@ var _ = Describe("Create template", func() {
874
874
Expect (content ).NotTo (ContainSubstring (expectedContent ))
875
875
})
876
876
})
877
+
878
+ Context ("given tailwind add-on" , func () {
879
+ It ("contains lib/web/assets/stylesheets/vendors/tailwind folder" , func () {
880
+ cookiecutter := tests.Cookiecutter {
881
+ Variant : tests .Web ,
882
+ CssAddon : tests .Tailwind ,
883
+ }
884
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
885
+ _ , err := os .Stat ("lib/web/assets/stylesheets/vendors/tailwind" )
886
+
887
+ Expect (os .IsNotExist (err )).To (BeFalse ())
888
+ })
889
+
890
+ It ("contains tailwind.config.js file" , func () {
891
+ cookiecutter := tests.Cookiecutter {
892
+ Variant : tests .Web ,
893
+ CssAddon : tests .Tailwind ,
894
+ }
895
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
896
+ _ , err := os .Stat ("tailwind.config.js" )
897
+
898
+ Expect (os .IsNotExist (err )).To (BeFalse ())
899
+ })
900
+
901
+ It ("contains tailwind package in package.json" , func () {
902
+ cookiecutter := tests.Cookiecutter {
903
+ Variant : tests .Web ,
904
+ CssAddon : tests .Tailwind ,
905
+ }
906
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
907
+ content := tests .ReadFile ("package.json" )
908
+
909
+ expectedContent := "\" tailwindcss\" : \" 2.2.7\" "
910
+
911
+ Expect (content ).To (ContainSubstring (expectedContent ))
912
+ })
913
+
914
+ It ("contains tailwind scss import in lib/web/assets/stylesheets/application.scss" , func () {
915
+ cookiecutter := tests.Cookiecutter {
916
+ Variant : tests .Web ,
917
+ CssAddon : tests .Tailwind ,
918
+ }
919
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
920
+ content := tests .ReadFile ("lib/web/assets/stylesheets/application.scss" )
921
+
922
+ expectedContent := "@import \" ./vendors/tailwind\" ;"
923
+
924
+ Expect (content ).To (ContainSubstring (expectedContent ))
925
+ })
926
+
927
+ It ("contains tailwind requirement in postcss.config.js" , func () {
928
+ cookiecutter := tests.Cookiecutter {
929
+ Variant : tests .Web ,
930
+ CssAddon : tests .Tailwind ,
931
+ }
932
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
933
+ content := tests .ReadFile ("postcss.config.js" )
934
+
935
+ expectedContent := "require(\" tailwindcss\" )"
936
+
937
+ Expect (content ).To (ContainSubstring (expectedContent ))
938
+ })
939
+ })
940
+
941
+ Context ("given NO tailwind add-on" , func () {
942
+ It ("does NOT contain lib/web/assets/stylesheets/vendors/tailwind folder" , func () {
943
+ cookiecutter := tests.Cookiecutter {
944
+ Variant : tests .Web ,
945
+ CssAddon : tests .None ,
946
+ }
947
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
948
+ _ , err := os .Stat ("lib/web/assets/stylesheets/vendors/tailwind" )
949
+
950
+ Expect (os .IsNotExist (err )).To (BeTrue ())
951
+ })
952
+
953
+ It ("does NOT contain tailwind.config.js file" , func () {
954
+ cookiecutter := tests.Cookiecutter {
955
+ Variant : tests .Web ,
956
+ CssAddon : tests .None ,
957
+ }
958
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
959
+ _ , err := os .Stat ("tailwind.config.js" )
960
+
961
+ Expect (os .IsNotExist (err )).To (BeTrue ())
962
+ })
963
+
964
+ It ("does NOT contain tailwind package in package.json" , func () {
965
+ cookiecutter := tests.Cookiecutter {
966
+ Variant : tests .Web ,
967
+ CssAddon : tests .None ,
968
+ }
969
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
970
+ content := tests .ReadFile ("package.json" )
971
+
972
+ expectedContent := "\" tailwindcss\" :"
973
+
974
+ Expect (content ).NotTo (ContainSubstring (expectedContent ))
975
+ })
976
+
977
+ It ("does NOT contain tailwind scss import in lib/web/assets/stylesheets/application.scss" , func () {
978
+ cookiecutter := tests.Cookiecutter {
979
+ Variant : tests .Web ,
980
+ CssAddon : tests .None ,
981
+ }
982
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
983
+ content := tests .ReadFile ("lib/web/assets/stylesheets/application.scss" )
984
+
985
+ expectedContent := "@import \" ./vendors/tailwind\" ;"
986
+
987
+ Expect (content ).NotTo (ContainSubstring (expectedContent ))
988
+ })
989
+
990
+ It ("does NOT contain tailwind requirement in postcss.config.js" , func () {
991
+ cookiecutter := tests.Cookiecutter {
992
+ Variant : tests .Web ,
993
+ CssAddon : tests .None ,
994
+ }
995
+ cookiecutter .CreateProjectFromGinTemplate (currentTemplatePath )
996
+ content := tests .ReadFile ("postcss.config.js" )
997
+
998
+ expectedContent := "require(\" tailwindcss\" )"
999
+
1000
+ Expect (content ).NotTo (ContainSubstring (expectedContent ))
1001
+ })
1002
+ })
877
1003
})
0 commit comments