1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | class AirportMappingControllerTests extends GroovyTestCase{ void testWithBadIata(){ def controller = new AirportMappingController() controller.metaClass.getParams = {-> return ["id":"foo"] } controller.iata() def response = controller.response.contentAsString assertTrue response.contains("\"name\":\"Not found\"") println "Response for airport/iata/foo: ${response}" } void testWithGoodIata(){ def controller = new AirportMappingController() controller.metaClass.getParams = {-> return ["id":"den"] } controller.iata() def response = controller.response.contentAsString assertTrue response.contains("Denver") println "Response for airport/iata/den: ${response}" } } |
1 2 3 4 | class TripController { def scaffold = Trip def plan = {} } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <html> <head> <title>Plan</title> <script src="//maps.google.com/maps?file=api&v=2&key=YourKeyHere" type="text/javascript"></script> <script type="text/javascript"> var map var usCenterPoint = new GLatLng(39.833333, -98.583333) var usZoom = 4 function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")) map.setCenter(usCenterPoint, usZoom) map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); } } </script> </head> <body onload="load()" onunload="GUnload()"> <div class="body"> <div id="search" style="width:25%; float:left"> <h1>Where to?</h1> </div> <div id="map" style="width:75%; height:100%; float:right"></div> </div> </body> </html> |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |